[twitter] extend 'conversations' option (#4211)

pull/4268/head
Mike Fährmann 1 year ago
parent b6c959744d
commit c1cce4a80b
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -3002,15 +3002,19 @@ Description
extractor.twitter.conversations
-------------------------------
Type
``bool``
* ``bool``
* ``string``
Default
``false``
Description
For input URLs pointing to a single Tweet,
e.g. `https://twitter.com/i/web/status/<TweetID>`,
fetch media from all Tweets and replies in this `conversation
<https://help.twitter.com/en/using-twitter/twitter-conversations>`__
or thread.
<https://help.twitter.com/en/using-twitter/twitter-conversations>`__.
If this option is equal to ``"accessible"``,
only download from conversation Tweets
if the given initial Tweet is accessible.
extractor.twitter.csrf

@ -919,7 +919,9 @@ Your reaction.""",
self.tweet_id = match.group(2)
def tweets(self):
if self.config("conversations", False):
conversations = self.config("conversations")
if conversations:
self._accessible = (conversations == "accessible")
return self._tweets_conversation(self.tweet_id)
else:
return self._tweets_single(self.tweet_id)
@ -950,6 +952,11 @@ Your reaction.""",
tweet.get("_retweet_id_str") == tweet_id:
self._assign_user(tweet["core"]["user_results"]["result"])
break
else:
# initial Tweet not accessible
if self._accessible:
return ()
return buffer
return itertools.chain(buffer, tweets)

Loading…
Cancel
Save