1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[twitter] extend 'replies' option (#1254)

Allow setting 'replies to '"self"' to only download from self-replies.
This commit is contained in:
Mike Fährmann 2021-08-10 22:02:19 +02:00
parent f9096584ab
commit e5a93e113f
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 20 additions and 3 deletions

View File

@ -1899,6 +1899,9 @@ Default
Description
Fetch media from replies to other Tweets.
If this value is ``"self"``, only consider replies where
reply and original Tweet are from the same user.
extractor.twitter.retweets
--------------------------

View File

@ -50,12 +50,17 @@ class TwitterExtractor(Extractor):
if not self.retweets and "retweeted_status_id_str" in tweet:
self.log.debug("Skipping %s (retweet)", tweet["id_str"])
continue
if not self.replies and "in_reply_to_user_id_str" in tweet:
self.log.debug("Skipping %s (reply)", tweet["id_str"])
continue
if not self.quoted and "quoted" in tweet:
self.log.debug("Skipping %s (quoted tweet)", tweet["id_str"])
continue
if "in_reply_to_user_id_str" in tweet and (
not self.replies or (
self.replies == "self" and
tweet["in_reply_to_user_id_str"] != tweet["user_id_str"]
)
):
self.log.debug("Skipping %s (reply)", tweet["id_str"])
continue
files = []
if "extended_entities" in tweet:
@ -452,6 +457,15 @@ class TwitterTweetExtractor(TwitterExtractor):
"options": (("replies", False),),
"count": 0,
}),
# 'replies' to self (#1254)
("https://twitter.com/i/web/status/1424882930803908612", {
"options": (("replies", "self"),),
"count": 4,
}),
("https://twitter.com/i/web/status/1424898916156284928", {
"options": (("replies", "self"),),
"count": 0,
}),
# "quoted" option (#854)
("https://twitter.com/StobiesGalaxy/status/1270755918330896395", {
"options": (("quoted", True),),