如何使用 tweepy 获取整个推文而不是使用 link 的推文的一部分
How to get the whole tweet using tweepy instead of part of the tweet with a link
首先,我确实意识到有一个类似的问题,但使用的是 Twython 库,而不是 Tweepy。
此外,我已经看到 但是,在下面的 count=count
之后添加 , tweet_mode='extended'
会给我一个错误:AttributeError: 'Status' object has no attribute 'text'
这是我拥有的:
fetched_tweets = api.search(q, lang = 'en', count=count)
for tweet in fetched_tweets:
parsed_tweet = {}
parsed_tweet['text'] = tweet.text
line = re.sub('@[\w]+', '', tweet.text)
target.write(line+"\n")
target.write("--------------------------------------------------------------\n")
tweets.append(line)
因此,我正在创建这些推文的列表,但是其中一些推文显示如下:
ADAM ARON CONFIRMED IF WE VOTE YES ON THE 500M, AMC PLEDGES NOT TO DILUTE ANY OF IT IN CALENDAR YEAR 2021.
GIVE TH… h t t p s : / / t . c o / t D i T u x f d F g
(I had to add spaces between the letters of the link)
它应该改为:
ADAM ARON CONFIRMED IF WE VOTE YES ON THE 500M, AMC PLEDGES NOT TO
DILUTE ANY OF IT IN CALENDAR YEAR 2021.
GIVE THAT MAN HIS SHARES.
Within the legal confines of being a CEO, he is on our side and wants
the same thing we do.
changing my vote to Yes.
$amc #amc
为了解决这个问题,我能够将fetched_tweets = api.search(q, lang = 'en', count=count)
更改为fetched_tweets = api.search(q, lang = 'en', count=count, tweet_mode='extended')
,并将tweet.text
更改为tweet.full_text
。
首先,我确实意识到有一个类似的问题,但使用的是 Twython 库,而不是 Tweepy。
此外,我已经看到 count=count
之后添加 , tweet_mode='extended'
会给我一个错误:AttributeError: 'Status' object has no attribute 'text'
这是我拥有的:
fetched_tweets = api.search(q, lang = 'en', count=count)
for tweet in fetched_tweets:
parsed_tweet = {}
parsed_tweet['text'] = tweet.text
line = re.sub('@[\w]+', '', tweet.text)
target.write(line+"\n")
target.write("--------------------------------------------------------------\n")
tweets.append(line)
因此,我正在创建这些推文的列表,但是其中一些推文显示如下:
ADAM ARON CONFIRMED IF WE VOTE YES ON THE 500M, AMC PLEDGES NOT TO DILUTE ANY OF IT IN CALENDAR YEAR 2021.
GIVE TH… h t t p s : / / t . c o / t D i T u x f d F g (I had to add spaces between the letters of the link)
它应该改为:
ADAM ARON CONFIRMED IF WE VOTE YES ON THE 500M, AMC PLEDGES NOT TO DILUTE ANY OF IT IN CALENDAR YEAR 2021.
GIVE THAT MAN HIS SHARES.
Within the legal confines of being a CEO, he is on our side and wants the same thing we do.
changing my vote to Yes.
$amc #amc
为了解决这个问题,我能够将fetched_tweets = api.search(q, lang = 'en', count=count)
更改为fetched_tweets = api.search(q, lang = 'en', count=count, tweet_mode='extended')
,并将tweet.text
更改为tweet.full_text
。