Created
September 20, 2012 07:19
-
-
Save ym405nm/3754388 to your computer and use it in GitHub Desktop.
sample tweepy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search(self, text) : | |
api = tweepy.API() | |
results = api.search(urllib.quote_plus(text.encode('utf-8')), include_entities=True, lang=self.config[0]['lang']) | |
for result in results : | |
if result.entities.has_key('media') : | |
medias = result.entities['media'] | |
text = '@' + result.from_user + "\n" + result.text | |
for m in medias : | |
media_url = m['media_url'] | |
print media_url | |
save_img = self.save_img(media_url,filename) | |
self.upload(save_img,'img/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment