Twitter Search Query in Python

2019-04-02 09:12发布

I am trying to pull tweets matching the given search query. I'm using the following code :

import urllib2 as urllib
import json
response = urllib.urlopen("https://search.twitter.com/search.json?q=microsoft")
pyresponse = json.load(response)
print pyresponse

This was working a few days ago, but suddenly stopped working now. With some help from google, I learned that this type of url in not supported anymore.

How do I perform this search query. What url shall I use?

1条回答
一纸荒年 Trace。
2楼-- · 2019-04-02 10:17

Twitter is deprecating non-authenticated searches. You should look into Tweepy or another Python library that interacts with Twitter. https://github.com/tweepy/tweepy

查看更多
登录 后发表回答