Skip to content

Commit

Permalink
Dealing with missing expanded_url issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Jul 5, 2024
1 parent 51b3588 commit 4d19378
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion twitwi/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,11 @@ def normalize_tweet(tweet, locale=None, extract_referenced_tweets=False,
media_urls.append(med_url.split('?tag=')[0])
media_files.append('%s_%s' % (source_id, med_name))
media_alt_texts.append(entity.get("ext_alt_text") or '')
else:

# NOTE: fun fact, Twitter is starting to break down and we cannot guarantee
# expanded_url exists anymore. It even crashes the website itself lol:
# https://x.com/lmerzeau/status/426318495450943488
elif "expanded_url" in entity:
normalized = custom_normalize_url(entity['expanded_url'])
links.add(normalized)

Expand Down

0 comments on commit 4d19378

Please sign in to comment.