Skip to content

Commit

Permalink
removed appending old post flaw
Browse files Browse the repository at this point in the history
  • Loading branch information
bankubanku committed May 28, 2023
1 parent f3d696e commit 65a045d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
Binary file modified __pycache__/data_handling.cpython-311.pyc
Binary file not shown.
Binary file modified __pycache__/feed.cpython-311.pyc
Binary file not shown.
26 changes: 12 additions & 14 deletions data_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@ def is_old(new_time, last_time):
else:
return False


def get_data(parsed_entries, last_pubDate):

new_posts = []

for x in range(len(parsed_entries)):
for entry in parsed_entries.entries:
post_data = {
'author': None,
'title': None,
'link': None,
'published': None,
'description': None
'author': parsed_entries.feed.get('title', 'no data'),
'title': entry.get('title', 'no data'),
'link': entry.get('link', 'no data'),
'published': entry.get('published_parsed', gmtime()),
'description': entry.get('description', 'no data')
}
post_data['author'] = parsed_entries.feed.get('title', 'no data')
post_data['title'] = parsed_entries.entries[x].get('title', 'no data')
post_data['link'] = parsed_entries.entries[x].get('link', 'no data')
post_data['published'] = parsed_entries.entries[x].get('published_parsed', gmtime())
post_data['description'] = parsed_entries.entries[x].get('description', 'no data')

post_data['published'] = mktime(post_data['published'])

if post_data['description'] == 'no data':
post_data['description'] = parsed_entries.entries[x].get('summary', 'no data')

if is_old(post_data['published'], last_pubDate):
continue
else:
post_data['published'] = mktime(post_data['published']) #time.mktime(post_data['published'].timetuple())

new_posts.append(post_data)

return new_posts
Expand Down

0 comments on commit 65a045d

Please sign in to comment.