目前,我正在使用Twitter流API来获取某些关键字的实时推文。然而,我想在收到推文之前跳过那些无关紧要的推文。
使用搜索API,我可以搜索"hello -john“,这样我只能得到包含单词hello的tweet,而不能得到John,或者我可以搜索"hello Maria or Andrew”,所以我只能得到包含单词hello和Maria或Andrew的tweet。
使用流API,我只能给出关键字,但是有没有一种方法可以在这些关键字中使用-john或or之类的东西?
我正在建立一个机器人,它将复制和粘贴来自多个用户的推特(候选人到总统选举)。当我运行代码时,我的机器人实际上是在复制支持者的推文和转发,从而在我的页面上创建了疯狂的流量--我只想复制候选人自己从他们的账户上发布的 tweet。
有人知道怎么做吗?
我想:if tweetText.startswith('RT @'): pass可以解决RT问题,但显然不能.
这是我的代码:
import twitter, sys, json, csv, time
# this app is being run by cast laboratory..@CASTlaboratory (40036
我试图忽略我自己已经转发过的推文,但我真的不知道如何指定,我知道'if not tweet.retweeted:‘忽略转发,但我不确定如何忽略我在Twitter api搜索中已经转发的推文。
for tweet in tweepy.Cursor(api.search,
q='- Play Free Spin http://csgoroll.com/freespin',
since='2017-12-20',
screen_name='
根据twitter文档
A comma-separated list of user IDs, indicating the users whose Tweets should be delivered on the stream. Following protected users is not supported. For each user specified, the stream will contain:
Tweets created by the user.
Tweets which are retweeted by the user.
Replies to any Tweet