mirror of https://github.com/searxng/searxng.git
[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>
This commit is contained in:
parent
89b3050b5c
commit
8cdad5d85d
|
@ -195,19 +195,16 @@ def response(resp):
|
||||||
logger.error("no vidthumb imgdata for: %s" % img_id)
|
logger.error("no vidthumb imgdata for: %s" % img_id)
|
||||||
img_src = eval_xpath(c_node, './div[1]//a/g-img/img/@src')[0]
|
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'))
|
length = extract_text(eval_xpath(c_node, './/div[1]//a/div[3]'))
|
||||||
content = extract_text(eval_xpath(c_node, './div[2]/span'))
|
content = extract_text(eval_xpath(c_node, './/div[2]/span'))
|
||||||
pub_info = extract_text(eval_xpath(c_node, './div[2]/div'))
|
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
|
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'url': url,
|
'url': url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'content': content,
|
'content': content,
|
||||||
|
'length': length,
|
||||||
|
'author': pub_info,
|
||||||
'thumbnail': img_src,
|
'thumbnail': img_src,
|
||||||
'template': 'videos.html',
|
'template': 'videos.html',
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue