Fix some empty lines, remove comments, lowercase non-globals.

master
josiah 4 years ago
parent 24a27c0776
commit cb61ff6d6c

@ -19,7 +19,7 @@ def munge_idiot_data(reddit_dict):
every url that comes through my apparatus. every url that comes through my apparatus.
""" """
protocol = 'https' protocol = 'https'
# pdb.set_trace()
for single_dict in reddit_dict: for single_dict in reddit_dict:
if protocol in single_dict['url']: if protocol in single_dict['url']:
pass pass
@ -162,17 +162,17 @@ def main(*args, **kwargs):
your_user = reddit.redditor(parsed.reddit_un) your_user = reddit.redditor(parsed.reddit_un)
saved_posts = your_user.saved(limit=None) saved_posts = your_user.saved(limit=None)
POSTS_TO_SAVE = [] posts_to_save = []
for link in saved_posts: for link in saved_posts:
if hasattr(link, 'is_self'): if hasattr(link, 'is_self'):
POSTS_TO_SAVE.append({ posts_to_save.append({
'title': link.title, 'title': link.title,
'tag': link.subreddit.display_name + ' added-by-pynnit', 'tag': link.subreddit.display_name + ' added-by-pynnit',
'description': link.selftext, 'description': link.selftext,
'url': link.permalink 'url': link.permalink
}) })
elif hasattr(link, 'is_root'): elif hasattr(link, 'is_root'):
POSTS_TO_SAVE.append({ posts_to_save.append({
'title': link.link_title, 'title': link.link_title,
'tag': link.subreddit.display_name + ' added-by-pynnit', 'tag': link.subreddit.display_name + ' added-by-pynnit',
'description': link.body, 'description': link.body,
@ -181,9 +181,9 @@ def main(*args, **kwargs):
else: else:
print("shit is fucked.") print("shit is fucked.")
MUNGED_DATA = munge_idiot_data(POSTS_TO_SAVE) munged_data = munge_idiot_data(posts_to_save)
with open('data.json', 'w') as outfile: with open('data.json', 'w') as outfile:
json.dump(MUNGED_DATA, outfile, indent=2) json.dump(munged_data, outfile, indent=2)
# handle the pinboard side of things # handle the pinboard side of things

Loading…
Cancel
Save