def searchTweets(self, tag, limit=50000, tfilter=" -filter:retweets", resultType="recent"):
# if tfilter is appended to tag, it'll have some problem about tqdm, or what???.
# I don't know why it'll have the problem.
#tag += tfilter
try:
tweets = []
tweetsObj = tweepy.Cursor(self.API.search,
q=tag,
result_type=resultType,
exclude_replies = True).items(limit)
pBar = tqdm(tweetsObj, ascii=True, total=limit, desc="Getting Tweets!")
for cnt, tweet in enumerate(pBar):
pBar.update(1)
if not cnt < limit:
break
tweets.append(tweet)
except tweepy.error.TweepError as et:
print(et)
except Exception as e:
print(e)
return tweets
# if the tweets has more than 2 tweet which is tweeted by same user, it delete old tweet.
评论列表
文章目录