diff --git a/find_posts.py b/find_posts.py index 8d5fb3c..22f23db 100644 --- a/find_posts.py +++ b/find_posts.py @@ -74,7 +74,7 @@ def add_user_posts(server, access_token, followings, know_followings, all_known_ count = 0 failed = 0 for post in posts: - if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls: + if post.get('reblog') is None and post.get('url') is not None and post.get('url') not in seen_urls: added = add_post_with_context(post, server, access_token, seen_urls) if added is True: seen_urls.add(post['url']) @@ -90,7 +90,7 @@ def add_post_with_context(post, server, access_token, seen_urls): added = add_context_url(post['url'], server, access_token) if added is True: seen_urls.add(post['url']) - if (post['replies_count'] or post['in_reply_to_id']) and arguments.backfill_with_context > 0: + if ('replies_count' in post or 'in_reply_to_id' in post) and getattr(arguments, 'backfill_with_context', 0) > 0: parsed_urls = {} parsed = parse_url(post['url'], parsed_urls) if parsed == None: