Skip to content

Commit

Permalink
[twitter] prioritize tweet type checks (mikf#3439)
Browse files Browse the repository at this point in the history
Do not consider a tweet seen before applying 'retweet', 'quote' and
'reply' checks. Otherwise the original tweets will also be skipped if
the "derivative" tweets and the original tweets are from the same user.
  • Loading branch information
ClosedPort22 committed Dec 24, 2022
1 parent 2d7d80d commit 250d351
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gallery_dl/extractor/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ def items(self):
else:
data = tweet

if seen_tweets is not None:
if data["id_str"] in seen_tweets:
continue
seen_tweets.add(data["id_str"])

if not self.retweets and "retweeted_status_id_str" in data:
self.log.debug("Skipping %s (retweet)", data["id_str"])
continue
Expand All @@ -97,6 +92,13 @@ def items(self):
self.log.debug("Skipping %s (reply)", data["id_str"])
continue

if seen_tweets is not None:
if data["id_str"] in seen_tweets:
self.log.debug(
"Skipping %s (previously seen)", data["id_str"])
continue
seen_tweets.add(data["id_str"])

files = []
if "extended_entities" in data:
self._extract_media(
Expand Down

0 comments on commit 250d351

Please sign in to comment.