Skip to content
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.

Commit

Permalink
twitter returns weird result sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
ompugao committed Jan 14, 2023
1 parent 3820ac7 commit 5c31a94
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/markshift/htmlrenderer4preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def get_twitter_embed(tweet_url: str):

api = "https://publish.twitter.com/oembed?url={}".format(tweet_url)
res = requests.get(api)
j = res.json()
try:
j = res.json()
except requests.exceptions.JSONDecodeError as e:
return None
if 'html' in j.keys():
return j['html']
else:
Expand Down

0 comments on commit 5c31a94

Please sign in to comment.