Skip to content

Instantly share code, notes, and snippets.

@ym405nm
Created September 20, 2012 07:19
Show Gist options
  • Save ym405nm/3754388 to your computer and use it in GitHub Desktop.
Save ym405nm/3754388 to your computer and use it in GitHub Desktop.
sample tweepy
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