[twitter] change some defaults

- 'retweets' option: true -> false
- 'quoted' option  : true -> false

  i.e. disable downloading tweets from other user's timelines by default

- search directory:
    '["{category}", "Search", "{search}"]' ->
    '["{category}", "{user[name]}"]'

  i.e. change it to the same as other twitter extractors (#1308)
This commit is contained in:
Mike Fährmann
2021-06-11 21:19:04 +02:00
parent 4e4ca3c330
commit a751afdfb3
3 changed files with 10 additions and 11 deletions

View File

@@ -1715,7 +1715,7 @@ extractor.twitter.quoted
Type Type
``bool`` ``bool``
Default Default
``true`` ``false``
Description Description
Fetch media from quoted Tweets. Fetch media from quoted Tweets.
@@ -1735,7 +1735,7 @@ extractor.twitter.retweets
Type Type
``bool`` ``bool``
Default Default
``true`` ``false``
Description Description
Fetch media from Retweets. Fetch media from Retweets.

View File

@@ -256,9 +256,9 @@
"password": null, "password": null,
"cards": false, "cards": false,
"conversations": false, "conversations": false,
"quoted": true, "quoted": false,
"replies": true, "replies": true,
"retweets": true, "retweets": false,
"text-tweets": false, "text-tweets": false,
"twitpic": false, "twitpic": false,
"users": "timeline", "users": "timeline",

View File

@@ -33,10 +33,10 @@ class TwitterExtractor(Extractor):
Extractor.__init__(self, match) Extractor.__init__(self, match)
self.user = match.group(1) self.user = match.group(1)
self.textonly = self.config("text-tweets", False) self.textonly = self.config("text-tweets", False)
self.retweets = self.config("retweets", True) self.retweets = self.config("retweets", False)
self.replies = self.config("replies", True) self.replies = self.config("replies", True)
self.twitpic = self.config("twitpic", False) self.twitpic = self.config("twitpic", False)
self.quoted = self.config("quoted", True) self.quoted = self.config("quoted", False)
self.videos = self.config("videos", True) self.videos = self.config("videos", True)
self.cards = self.config("cards", False) self.cards = self.config("cards", False)
self._user_cache = {} self._user_cache = {}
@@ -44,7 +44,6 @@ class TwitterExtractor(Extractor):
def items(self): def items(self):
self.login() self.login()
metadata = self.metadata() metadata = self.metadata()
yield Message.Version, 1
for tweet in self.tweets(): for tweet in self.tweets():
@@ -406,7 +405,6 @@ class TwitterFollowingExtractor(TwitterExtractor):
class TwitterSearchExtractor(TwitterExtractor): class TwitterSearchExtractor(TwitterExtractor):
"""Extractor for all images from a search timeline""" """Extractor for all images from a search timeline"""
subcategory = "search" subcategory = "search"
directory_fmt = ("{category}", "Search", "{search}")
pattern = BASE_PATTERN + r"/search/?\?(?:[^&#]+&)*q=([^&#]+)" pattern = BASE_PATTERN + r"/search/?\?(?:[^&#]+&)*q=([^&#]+)"
test = ("https://twitter.com/search?q=nature", { test = ("https://twitter.com/search?q=nature", {
"range": "1-40", "range": "1-40",
@@ -456,14 +454,14 @@ class TwitterTweetExtractor(TwitterExtractor):
"options": (("replies", False),), "options": (("replies", False),),
"count": 0, "count": 0,
}), }),
# quoted tweet (#526, #854) # "quoted" option (#854)
("https://twitter.com/StobiesGalaxy/status/1270755918330896395", { ("https://twitter.com/StobiesGalaxy/status/1270755918330896395", {
"options": (("quoted", True),),
"pattern": r"https://pbs\.twimg\.com/media/Ea[KG].+=jpg", "pattern": r"https://pbs\.twimg\.com/media/Ea[KG].+=jpg",
"count": 8, "count": 8,
}), }),
# "quoted" option (#854) # quoted tweet (#526, #854)
("https://twitter.com/StobiesGalaxy/status/1270755918330896395", { ("https://twitter.com/StobiesGalaxy/status/1270755918330896395", {
"options": (("quoted", False),),
"pattern": r"https://pbs\.twimg\.com/media/EaK.+=jpg", "pattern": r"https://pbs\.twimg\.com/media/EaK.+=jpg",
"count": 4, "count": 4,
}), }),
@@ -499,6 +497,7 @@ class TwitterTweetExtractor(TwitterExtractor):
}), }),
# retweet with missing media entities (#1555) # retweet with missing media entities (#1555)
("https://twitter.com/morino_ya/status/1392763691599237121", { ("https://twitter.com/morino_ya/status/1392763691599237121", {
"options": (("retweets", True),),
"count": 4, "count": 4,
}), }),
) )