summaryrefslogtreecommitdiff
path: root/searx/engines/imdb.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-10-05 09:00:13 +0200
committerAlexandre Flament <alex@al-f.net>2021-10-05 09:10:02 +0200
commit8a897b86f1d5eb921f25efcf736b67e4485a3065 (patch)
tree1a0f50fa2fa4b08034915bb9c771a416add4f6c2 /searx/engines/imdb.py
parent823d44ed0a267335fce4d6ae172a4342e7439d7b (diff)
downloadsearxng-8a897b86f1d5eb921f25efcf736b67e4485a3065.tar.gz
searxng-8a897b86f1d5eb921f25efcf736b67e4485a3065.zip
[mod] engines - IMDB: add thumbnails
Diffstat (limited to 'searx/engines/imdb.py')
-rw-r--r--searx/engines/imdb.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/searx/engines/imdb.py b/searx/engines/imdb.py
index 88913ddc6..a3dab736d 100644
--- a/searx/engines/imdb.py
+++ b/searx/engines/imdb.py
@@ -81,15 +81,25 @@ def response(resp):
content += entry['s']
# imageUrl is the image itself, it is not a thumb!
- # image_url = entry['i']['imageUrl']
-
+ image_url = entry.get('i', {}).get('imageUrl')
+ if image_url:
+ # get thumbnail
+ image_url_name, image_url_prefix = image_url.rsplit('.', 1)
+ # recipe to get the magic value:
+ # * search on imdb.com, look at the URL of the thumbnail on the right side of the screen
+ # * search using the imdb engine, compare the imageUrl and thumbnail URL
+ # QL75 : JPEG quality (?)
+ # UX280 : resize to width 320
+ # 280,414 : size of the image (add white border)
+ magic = 'QL75_UX280_CR0,0,280,414_'
+ if not image_url_name.endswith('_V1_'):
+ magic = '_V1_' + magic
+ image_url = image_url_name + magic + '.' + image_url_prefix
results.append({
"title": title,
"url": href_base.format(category=categ, entry_id=entry_id),
"content": content,
- # "thumbnail" : image_url,
- # "template": "videos.html",
-
+ "img_src" : image_url,
})
return results