Skip to content

Commit

Permalink
[twitter] make 'source' metadata extraction non-fatal (#6472)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 14, 2024
1 parent 396b52a commit cfe24a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gallery_dl/extractor/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def _transform_tweet(self, tweet):
legacy["created_at"], "%a %b %d %H:%M:%S %z %Y")
except Exception:
date = util.NONE
source = tweet.get("source")

tdata = {
"tweet_id" : tweet_id,
Expand All @@ -320,7 +321,7 @@ def _transform_tweet(self, tweet):
"author" : author,
"user" : self._user or author,
"lang" : legacy["lang"],
"source" : text.extr(tweet["source"], ">", "<"),
"source" : text.extr(source, ">", "<") if source else "",
"sensitive" : tget("possibly_sensitive"),
"favorite_count": tget("favorite_count"),
"quote_count" : tget("quote_count"),
Expand Down

0 comments on commit cfe24a9

Please sign in to comment.