[chore] engines: replace datetime.utcfromtimestamp with datetime.fromtimestamp

This commit is contained in:
Bnyro 2025-02-05 14:35:02 +01:00 committed by Markus Heiser
parent 9b1f8681a1
commit 28ead13eb9
9 changed files with 10 additions and 10 deletions

View File

@ -51,7 +51,7 @@ def response(resp):
'url': result['url'], 'url': result['url'],
'title': result['title'], 'title': result['title'],
'content': result['description'], 'content': result['description'],
'publishedDate': datetime.utcfromtimestamp(result['creationTs']), 'publishedDate': datetime.fromtimestamp(result['creationTs']),
'img_src': result['images']['image700']['url'], 'img_src': result['images']['image700']['url'],
'thumbnail_src': thumbnail, 'thumbnail_src': thumbnail,
} }
@ -63,7 +63,7 @@ def response(resp):
'url': result['url'], 'url': result['url'],
'title': result['title'], 'title': result['title'],
'content': result['description'], 'content': result['description'],
'publishedDate': datetime.utcfromtimestamp(result['creationTs']), 'publishedDate': datetime.fromtimestamp(result['creationTs']),
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'iframe_src': result['images'].get('image460sv', {}).get('url'), 'iframe_src': result['images'].get('image460sv', {}).get('url'),
} }

View File

@ -82,7 +82,7 @@ def response(resp):
video_id = item["aid"] video_id = item["aid"]
unix_date = item["pubdate"] unix_date = item["pubdate"]
formatted_date = datetime.utcfromtimestamp(unix_date) formatted_date = datetime.fromtimestamp(unix_date)
formatted_duration = format_duration(item["duration"]) formatted_duration = format_duration(item["duration"])
iframe_url = f"https://player.bilibili.com/player.html?aid={video_id}&high_quality=1&autoplay=false&danmaku=0" iframe_url = f"https://player.bilibili.com/player.html?aid={video_id}&high_quality=1&autoplay=false&danmaku=0"

View File

@ -51,7 +51,7 @@ def response(resp):
publishedDate = None publishedDate = None
if result['extension'].get('publishingDate'): if result['extension'].get('publishingDate'):
publishedDate = datetime.utcfromtimestamp(result['extension']['publishingDate']) publishedDate = datetime.fromtimestamp(result['extension']['publishingDate'])
results.append( results.append(
{ {

View File

@ -128,7 +128,7 @@ def _news_result(result):
'title': result['title'], 'title': result['title'],
'content': result['excerpt'], 'content': result['excerpt'],
'source': result['source'], 'source': result['source'],
'publishedDate': datetime.utcfromtimestamp(result['date']), 'publishedDate': datetime.fromtimestamp(result['date']),
} }

View File

@ -38,7 +38,7 @@ def response(resp):
img = 'https://s3.thehackerblog.com/findthatmeme/' + item['image_path'] img = 'https://s3.thehackerblog.com/findthatmeme/' + item['image_path']
thumb = 'https://s3.thehackerblog.com/findthatmeme/thumb/' + item.get('thumbnail', '') thumb = 'https://s3.thehackerblog.com/findthatmeme/thumb/' + item.get('thumbnail', '')
date = datetime.strptime(item["updated_at"].split("T")[0], "%Y-%m-%d") date = datetime.strptime(item["updated_at"].split("T")[0], "%Y-%m-%d")
formatted_date = datetime.utcfromtimestamp(date.timestamp()) formatted_date = datetime.fromtimestamp(date.timestamp())
results.append( results.append(
{ {

View File

@ -87,7 +87,7 @@ def response(resp):
"content": hit.get("url") or hit.get("comment_text") or hit.get("story_text") or "", "content": hit.get("url") or hit.get("comment_text") or hit.get("story_text") or "",
"metadata": metadata, "metadata": metadata,
"author": hit["author"], "author": hit["author"],
"publishedDate": datetime.utcfromtimestamp(hit["created_at_i"]), "publishedDate": datetime.fromtimestamp(hit["created_at_i"]),
} }
) )

View File

@ -88,7 +88,7 @@ def response(resp):
duration = item["duration"] duration = item["duration"]
release_date = datetime.strptime(release_time.split("T")[0], "%Y-%m-%d") release_date = datetime.strptime(release_time.split("T")[0], "%Y-%m-%d")
formatted_date = datetime.utcfromtimestamp(release_date.timestamp()) formatted_date = datetime.fromtimestamp(release_date.timestamp())
url = f"https://odysee.com/{name}:{claim_id}" url = f"https://odysee.com/{name}:{claim_id}"
iframe_url = f"https://odysee.com/$/embed/{name}:{claim_id}" iframe_url = f"https://odysee.com/$/embed/{name}:{claim_id}"

View File

@ -112,7 +112,7 @@ def response(resp):
table_content = generate_condition_table(hourly_data) table_content = generate_condition_table(hourly_data)
infobox += f"<h3>{datetime.utcfromtimestamp(time).strftime('%Y-%m-%d %H:%M')}</h3>" infobox += f"<h3>{datetime.fromtimestamp(time).strftime('%Y-%m-%d %H:%M')}</h3>"
infobox += f"<table><tbody>{table_content}</tbody></table>" infobox += f"<table><tbody>{table_content}</tbody></table>"
return [{'infobox': 'Open Meteo', 'content': infobox}] return [{'infobox': 'Open Meteo', 'content': infobox}]

View File

@ -34,7 +34,7 @@ def response(resp):
'title': result['title'], 'title': result['title'],
'content': result['description'], 'content': result['description'],
'thumbnail': result['image'], 'thumbnail': result['image'],
'publishedDate': datetime.utcfromtimestamp(result['newestItemPubdate']), 'publishedDate': datetime.fromtimestamp(result['newestItemPubdate']),
'metadata': f"{result['author']}, {result['episodeCount']} episodes", 'metadata': f"{result['author']}, {result['episodeCount']} episodes",
} }
) )