mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
c
This commit is contained in:
parent
6d9cc311d2
commit
8d3237abb7
1 changed files with 4 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
from json import loads
|
from json import loads
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
import datetime
|
||||||
SEARCH_URL = "https://api.themoviedb.org/3/search/multi"
|
SEARCH_URL = "https://api.themoviedb.org/3/search/multi"
|
||||||
API_KEY = "f6bd687ffa63cd282b6ff2c6877f2669"
|
API_KEY = "f6bd687ffa63cd282b6ff2c6877f2669"
|
||||||
|
|
||||||
|
@ -18,11 +19,13 @@ def response(resp):
|
||||||
data = loads(resp.text)["results"]
|
data = loads(resp.text)["results"]
|
||||||
if data:
|
if data:
|
||||||
for item in data:
|
for item in data:
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"title": item.get("name"),
|
"title": item.get("name"),
|
||||||
"url": f"https://www.themoviedb.org/{item.get('media_type')}/{item.get('id')}",
|
"url": f"https://www.themoviedb.org/{item.get('media_type')}/{item.get('id')}",
|
||||||
"content": item.get("overview"),
|
"content": item.get("overview"),
|
||||||
"publishedDate": item.get("release_date") or item.get("first_air_date"),
|
|
||||||
}
|
}
|
||||||
|
if item.get("release_date") or item.get("first_air_date"):
|
||||||
|
result['publishedDate'] = datetime.datetime.strptime(item.get("release_date") or item.get("first_air_date"), '%Y-%m-%d')
|
||||||
results.append(result)
|
results.append(result)
|
||||||
return results
|
return results
|
Loading…
Add table
Reference in a new issue