简体   繁体   中英

Twitter Search Query in Python

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM