Improve logging, sends tweets to nitter.net

This commit is contained in:
2022-03-05 23:48:46 +00:00
parent a693ea5342
commit a25457254f
7 changed files with 33 additions and 11 deletions

View File

@@ -34,6 +34,10 @@ def get_article(url):
logging.info('Readerserver not configured, aborting.')
return ''
if url.startswith('https://twitter.com'):
logging.info('Replacing twitter.com url with nitter.net')
url = url.replace('twitter.com', 'nitter.net')
try:
r = requests.post(settings.READER_URL, data=dict(url=url), timeout=20)
if r.status_code != 200:
@@ -82,7 +86,7 @@ def update_story(story, is_manual=False):
return False
if story['date'] and not is_manual and story['date'] + TWO_DAYS < time.time():
logging.info('Story too old, removing')
logging.info('Story too old, removing. Date: {}'.format(story['date']))
return False
if story.get('url', '') and not story.get('text', ''):