|
|
|
@ -68,16 +68,21 @@ def get_content_type(url): |
|
|
|
|
def update_story(story, is_manual=False): |
|
|
|
|
res = {} |
|
|
|
|
|
|
|
|
|
if story['source'] == 'hackernews': |
|
|
|
|
res = hackernews.story(story['ref']) |
|
|
|
|
elif story['source'] == 'lobsters': |
|
|
|
|
res = lobsters.story(story['ref']) |
|
|
|
|
elif story['source'] == 'reddit': |
|
|
|
|
res = reddit.story(story['ref']) |
|
|
|
|
elif story['source'] == 'tildes': |
|
|
|
|
res = tildes.story(story['ref']) |
|
|
|
|
elif story['source'] == 'manual': |
|
|
|
|
res = manual.story(story['ref']) |
|
|
|
|
try: |
|
|
|
|
if story['source'] == 'hackernews': |
|
|
|
|
res = hackernews.story(story['ref']) |
|
|
|
|
elif story['source'] == 'lobsters': |
|
|
|
|
res = lobsters.story(story['ref']) |
|
|
|
|
elif story['source'] == 'reddit': |
|
|
|
|
res = reddit.story(story['ref']) |
|
|
|
|
elif story['source'] == 'tildes': |
|
|
|
|
res = tildes.story(story['ref']) |
|
|
|
|
elif story['source'] == 'manual': |
|
|
|
|
res = manual.story(story['ref']) |
|
|
|
|
except BaseException as e: |
|
|
|
|
utils.alert_tanner('Problem updating {} story, ref {}: {}'.format(story['source'], story['ref'], str(e))) |
|
|
|
|
logging.exception(e) |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
if res: |
|
|
|
|
story.update(res) # join dicts |
|
|
|
|