[twitter] extend 'conversations' option (#4211)
This commit is contained in:
@@ -3002,15 +3002,19 @@ Description
|
|||||||
extractor.twitter.conversations
|
extractor.twitter.conversations
|
||||||
-------------------------------
|
-------------------------------
|
||||||
Type
|
Type
|
||||||
``bool``
|
* ``bool``
|
||||||
|
* ``string``
|
||||||
Default
|
Default
|
||||||
``false``
|
``false``
|
||||||
Description
|
Description
|
||||||
For input URLs pointing to a single Tweet,
|
For input URLs pointing to a single Tweet,
|
||||||
e.g. `https://twitter.com/i/web/status/<TweetID>`,
|
e.g. `https://twitter.com/i/web/status/<TweetID>`,
|
||||||
fetch media from all Tweets and replies in this `conversation
|
fetch media from all Tweets and replies in this `conversation
|
||||||
<https://help.twitter.com/en/using-twitter/twitter-conversations>`__
|
<https://help.twitter.com/en/using-twitter/twitter-conversations>`__.
|
||||||
or thread.
|
|
||||||
|
If this option is equal to ``"accessible"``,
|
||||||
|
only download from conversation Tweets
|
||||||
|
if the given initial Tweet is accessible.
|
||||||
|
|
||||||
|
|
||||||
extractor.twitter.csrf
|
extractor.twitter.csrf
|
||||||
|
|||||||
@@ -919,7 +919,9 @@ Your reaction.""",
|
|||||||
self.tweet_id = match.group(2)
|
self.tweet_id = match.group(2)
|
||||||
|
|
||||||
def tweets(self):
|
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)
|
return self._tweets_conversation(self.tweet_id)
|
||||||
else:
|
else:
|
||||||
return self._tweets_single(self.tweet_id)
|
return self._tweets_single(self.tweet_id)
|
||||||
@@ -950,6 +952,11 @@ Your reaction.""",
|
|||||||
tweet.get("_retweet_id_str") == tweet_id:
|
tweet.get("_retweet_id_str") == tweet_id:
|
||||||
self._assign_user(tweet["core"]["user_results"]["result"])
|
self._assign_user(tweet["core"]["user_results"]["result"])
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
# initial Tweet not accessible
|
||||||
|
if self._accessible:
|
||||||
|
return ()
|
||||||
|
return buffer
|
||||||
|
|
||||||
return itertools.chain(buffer, tweets)
|
return itertools.chain(buffer, tweets)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user