Skip to content

Instantly share code, notes, and snippets.

@rafaelnovello
Created October 23, 2012 01:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelnovello/3936092 to your computer and use it in GitHub Desktop.
Save rafaelnovello/3936092 to your computer and use it in GitHub Desktop.
Como pegar quem deu Retweet.
#coding: utf-8
import urllib2, json, sys
#Requisição para pegar quem deu retweet de um post. O sys.argv[1] é o id do tweet.
resp = urllib2.urlopen('http://api.twitter.com/1/statuses/%s/retweeted_by.json' % sys.argv[1])
#Carrega a resposta para um dicionário.
retweeters = json.loads(resp.read())
#Percorre a lista de quem deu retweet e mostra as informações de cada pessoa.
for retweeter in retweeters:
print retweeter['screen_name'], retweeter['name'], retweeter['followers_count']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment