on master help sign in
[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>

commit8cdad5d85d0a0e5f1c6b62bf2dfcfdbafeda92b9 authorMarkus Heiser <markus.heiser@darmarit.de> dateSat 23 Jan 2021, 10:20 (6 years ago) parent89b3050
1 file changed+10−13
searx/engines/google_videos.py+10−13
searx/engines/google_videos.py+10−13
@@ -195,21 +195,18 @@ def response(resp):
195195 logger.error("no vidthumb imgdata for: %s" % img_id)
196196 img_src = eval_xpath(c_node, './div[1]//a/g-img/img/@src')[0]
197197
198− duration = extract_text(eval_xpath(c_node, './div[1]//a/span'))
199− content = extract_text(eval_xpath(c_node, './div[2]/span'))
200− pub_info = extract_text(eval_xpath(c_node, './div[2]/div'))
201−
202− if len(duration) > 3:
203− content = duration + " - " + content
204− if pub_info:
205− content = content + " (%s)" % pub_info
198+ length = extract_text(eval_xpath(c_node, './/div[1]//a/div[3]'))
199+ content = extract_text(eval_xpath(c_node, './/div[2]/span'))
200+ pub_info = extract_text(eval_xpath(c_node, './/div[2]/div'))
206201
207202 results.append({
208− 'url': url,
209− 'title': title,
210− 'content': content,
211− 'thumbnail': img_src,
212− 'template': 'videos.html',
203+ 'url': url,
204+ 'title': title,
205+ 'content': content,
206+ 'length': length,
207+ 'author': pub_info,
208+ 'thumbnail': img_src,
209+ 'template': 'videos.html',
213210 })
214211
215212 # parse suggestion