summaryrefslogtreecommitdiff
path: root/searx/engines/google_videos.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-01-23 10:20:27 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-01-24 09:51:24 +0100
commit8cdad5d85d0a0e5f1c6b62bf2dfcfdbafeda92b9 (patch)
tree1969cf753d520d2c961b1937bf0c23f45a8d9bb7 /searx/engines/google_videos.py
parent89b3050b5c406f795dd25d24f182cf173ad42774 (diff)
downloadsearxng-8cdad5d85d0a0e5f1c6b62bf2dfcfdbafeda92b9.tar.gz
searxng-8cdad5d85d0a0e5f1c6b62bf2dfcfdbafeda92b9.zip
[fix] google-videos: parse values for 'length' & 'author'
The 'video.html' template from the 'oscar' design supports replacement for *author* and *length*. Google-videos does not have an author, alternatively the publisher info from is used for the *author*. Hint: these replacements are not supported by the 'simple' design. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/google_videos.py')
-rw-r--r--searx/engines/google_videos.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/searx/engines/google_videos.py b/searx/engines/google_videos.py
index 486ba7ccd..8bce054d6 100644
--- a/searx/engines/google_videos.py
+++ b/searx/engines/google_videos.py
@@ -195,21 +195,18 @@ def response(resp):
logger.error("no vidthumb imgdata for: %s" % img_id)
img_src = eval_xpath(c_node, './div[1]//a/g-img/img/@src')[0]
- duration = extract_text(eval_xpath(c_node, './div[1]//a/span'))
- content = extract_text(eval_xpath(c_node, './div[2]/span'))
- pub_info = extract_text(eval_xpath(c_node, './div[2]/div'))
-
- if len(duration) > 3:
- content = duration + " - " + content
- if pub_info:
- content = content + " (%s)" % pub_info
+ length = extract_text(eval_xpath(c_node, './/div[1]//a/div[3]'))
+ content = extract_text(eval_xpath(c_node, './/div[2]/span'))
+ pub_info = extract_text(eval_xpath(c_node, './/div[2]/div'))
results.append({
- 'url': url,
- 'title': title,
- 'content': content,
- 'thumbnail': img_src,
- 'template': 'videos.html',
+ 'url': url,
+ 'title': title,
+ 'content': content,
+ 'length': length,
+ 'author': pub_info,
+ 'thumbnail': img_src,
+ 'template': 'videos.html',
})
# parse suggestion