mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 12:12:34 +01:00
[twitter] ignore previously seen Tweets (#2712)
occurs primarily for /with_replies results when logged in
This commit is contained in:
parent
4b2a0a0eda
commit
1d14928bd9
@ -2415,6 +2415,16 @@ Description
|
|||||||
Extract `TwitPic <https://twitpic.com/>`__ embeds.
|
Extract `TwitPic <https://twitpic.com/>`__ embeds.
|
||||||
|
|
||||||
|
|
||||||
|
extractor.twitter.unique
|
||||||
|
------------------------
|
||||||
|
Type
|
||||||
|
``bool``
|
||||||
|
Default
|
||||||
|
``true``
|
||||||
|
Description
|
||||||
|
Ignore previously seen Tweets.
|
||||||
|
|
||||||
|
|
||||||
extractor.twitter.users
|
extractor.twitter.users
|
||||||
-----------------------
|
-----------------------
|
||||||
Type
|
Type
|
||||||
|
@ -288,6 +288,7 @@
|
|||||||
"strategy": null,
|
"strategy": null,
|
||||||
"text-tweets": false,
|
"text-tweets": false,
|
||||||
"twitpic": false,
|
"twitpic": false,
|
||||||
|
"unique": true,
|
||||||
"users": "timeline",
|
"users": "timeline",
|
||||||
"videos": true
|
"videos": true
|
||||||
},
|
},
|
||||||
|
@ -64,6 +64,11 @@ class TwitterExtractor(Extractor):
|
|||||||
tweets = self._expand_tweets(self.tweets())
|
tweets = self._expand_tweets(self.tweets())
|
||||||
self.tweets = lambda : tweets
|
self.tweets = lambda : tweets
|
||||||
|
|
||||||
|
if self.config("unique", True):
|
||||||
|
seen_tweets = set()
|
||||||
|
else:
|
||||||
|
seen_tweets = None
|
||||||
|
|
||||||
for tweet in self.tweets():
|
for tweet in self.tweets():
|
||||||
|
|
||||||
if "legacy" in tweet:
|
if "legacy" in tweet:
|
||||||
@ -71,6 +76,11 @@ class TwitterExtractor(Extractor):
|
|||||||
else:
|
else:
|
||||||
data = tweet
|
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:
|
if not self.retweets and "retweeted_status_id_str" in data:
|
||||||
self.log.debug("Skipping %s (retweet)", data["id_str"])
|
self.log.debug("Skipping %s (retweet)", data["id_str"])
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user