Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python中使用TwitterAPI抓取包含特定链接的推文?_Python_Url_Twitter_Tweepy - Fatal编程技术网

如何在python中使用TwitterAPI抓取包含特定链接的推文?

如何在python中使用TwitterAPI抓取包含特定链接的推文?,python,url,twitter,tweepy,Python,Url,Twitter,Tweepy,我使用tweepy库检索包含特定链接的推文,但它不返回任何内容 代码如下: ####input your credentials here consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, acc

我使用tweepy库检索包含特定链接的推文,但它不返回任何内容

代码如下:

####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''

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)


for tweet in tweepy.Cursor(api.search,q='www.democracynow.org/2018/4/18/americas_1_weapons_salesman_trump_promotes', count=10,
                           lang="en",
                           since="2017-04-03").items():
    print (tweet.created_at, tweet.text)

我尝试了正常链接和编码链接,但都不起作用。没有错误,只是空的

有解决办法吗?

如果执行,您将看到没有结果。
相反,您可能希望搜索
”https://www.democracynow.org/2018/4/18/americas_1_weapons_salesman_trump_promotes“

然而,请注意,Twitter的搜索期限为7天,而且该搜索的所有结果都比这要旧得多。对于较旧的结果,您必须使用premium或企业搜索API