Skip to content

Commit 0b245be

Browse files
authored
fix: Tuple or struct_time argument required
1 parent 2cd88ed commit 0b245be

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

utils/feed_action.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ def generate_atom_feed(feed_url: str, feed_dict: dict):
5555
return None
5656
try:
5757
source_feed = feed_dict['feed']
58-
pubdate = mktime(source_feed.get('published_parsed'))
59-
pubdate = datetime.fromtimestamp(pubdate, tz=timezone.utc) if pubdate else None
58+
pubdate = source_feed.get('published_parsed')
59+
pubdate = datetime.fromtimestamp(mktime(pubdate), tz=timezone.utc) if pubdate else None
6060

61-
updated = mktime(source_feed.get('updated_parsed'))
62-
updated = datetime.fromtimestamp(updated, tz=timezone.utc) if updated else None
61+
updated = source_feed.get('updated_parsed')
62+
updated = datetime.fromtimestamp(mktime(updated), tz=timezone.utc) if updated else None
6363

6464
title = get_first_non_none(source_feed, 'title', 'subtitle', 'info')
6565
subtitle = get_first_non_none(source_feed, 'subtitle')
@@ -86,11 +86,11 @@ def generate_atom_feed(feed_url: str, feed_dict: dict):
8686
fg.id(fg.title())
8787

8888
for entry in feed_dict['entries']:
89-
pubdate = mktime(entry.get('published_parsed'))
90-
pubdate = datetime.fromtimestamp(pubdate, tz=timezone.utc) if pubdate else None
89+
pubdate = source_feed.get('published_parsed')
90+
pubdate = datetime.fromtimestamp(mktime(pubdate), tz=timezone.utc) if pubdate else None
9191

92-
updated = mktime(entry.get('updated_parsed'))
93-
updated = datetime.fromtimestamp(updated, tz=timezone.utc) if updated else None
92+
updated = source_feed.get('updated_parsed')
93+
updated = datetime.fromtimestamp(mktime(updated), tz=timezone.utc) if updated else None
9494

9595
title = entry.get('title')
9696
link = get_first_non_none(entry, 'link')

0 commit comments

Comments
 (0)