【发布时间】:2020-07-10 11:11:39
【问题描述】:
我想用 tweepy 从 twitter 上抓取数据,但我不想在其中包含转推。怎么做?
这是我的代码:
import tweepy
import csv
consumer_key = 'xx'
consumer_secret = 'xx'
access_token = 'xx'
access_token_secret = 'xx'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True)
csvpefile = open ('netflix.csv', 'a')
csvWriter = csv.writer(csvpefile)
for tweet in tweepy.Cursor(api.search,
q=["netflix"],
lang="id",
since="2020-07-8",
tweet_mode = 'extended',
trucated='false').items(200):
print(tweet.created_at, tweet.id, tweet.full_text)
csvWriter.writerow([tweet.created_at, tweet.id, tweet.full_text.encode('utf-8')])
我试过了
count=None,
since_id=None,
max_id=None,
trim_user=False,
exclude_replies=False,
contributor_details=False,
include_entities=True):
和
q=["netflix -filter:retweets"]
在 api.search 中,但还是不行
【问题讨论】: