mirror of https://github.com/searx/searx
parent
8ecc8c5745
commit
bb34685dfa
|
@ -165,3 +165,4 @@ generally made searx better:
|
||||||
- @jhigginbotham
|
- @jhigginbotham
|
||||||
- @xenrox
|
- @xenrox
|
||||||
- @OliveiraHermogenes
|
- @OliveiraHermogenes
|
||||||
|
- Paul Alcock @Guilvareux
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
"""
|
||||||
|
IMDB - Internet Movie Database
|
||||||
|
Retrieves results from a basic search
|
||||||
|
Advanced search options are not supported
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
about = {
|
||||||
|
"website": 'https://imdb.com/',
|
||||||
|
"wikidata_id": 'Q37312',
|
||||||
|
"official_api_documentation": None,
|
||||||
|
"use_official_api": False,
|
||||||
|
"require_api_key": False,
|
||||||
|
"results": 'HTML',
|
||||||
|
}
|
||||||
|
|
||||||
|
categories = ['general']
|
||||||
|
paging = False
|
||||||
|
base_url = 'https://imdb.com/{category}/{id}'
|
||||||
|
suggestion_url = "https://v2.sg.media-imdb.com/suggestion/{letter}/{query}.json"
|
||||||
|
search_categories = {
|
||||||
|
"nm": "name",
|
||||||
|
"tt": "title",
|
||||||
|
"kw": "keyword",
|
||||||
|
"co": "company",
|
||||||
|
"ep": "episode"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def request(query, params):
|
||||||
|
query = query.replace(" ", "_").lower()
|
||||||
|
params['url'] = suggestion_url.format(letter=query[0], query=query)
|
||||||
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
def response(resp):
|
||||||
|
suggestions = json.loads(resp.text)
|
||||||
|
results = []
|
||||||
|
for entry in suggestions['d']:
|
||||||
|
content = ""
|
||||||
|
if entry['id'][:2] in search_categories:
|
||||||
|
href = base_url.format(category=search_categories[entry['id'][:2]], id=entry['id'])
|
||||||
|
if 'y' in entry:
|
||||||
|
content += str(entry['y']) + " - "
|
||||||
|
if 's' in entry:
|
||||||
|
content += entry['s']
|
||||||
|
results.append({
|
||||||
|
"title": entry['l'],
|
||||||
|
"url": href,
|
||||||
|
"content": content
|
||||||
|
})
|
||||||
|
return results
|
|
@ -699,6 +699,12 @@ engines:
|
||||||
require_api_key: false
|
require_api_key: false
|
||||||
results: JSON
|
results: JSON
|
||||||
|
|
||||||
|
- name : imdb
|
||||||
|
engine : imdb
|
||||||
|
shortcut : imdb
|
||||||
|
timeout : 6.0
|
||||||
|
disabled : True
|
||||||
|
|
||||||
- name : ina
|
- name : ina
|
||||||
engine : ina
|
engine : ina
|
||||||
shortcut : in
|
shortcut : in
|
||||||
|
|
Loading…
Reference in New Issue