Skip to content

Instantly share code, notes, and snippets.

@timf
Created June 9, 2012 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timf/2900907 to your computer and use it in GitHub Desktop.
Save timf/2900907 to your computer and use it in GitHub Desktop.
Use the long ID number in a Tweet URL as script argument
#!/usr/bin/env python
import json
import urllib
import sys
if len(sys.argv) < 2:
sys.exit('Usage: %s [Tweet ID #]' % sys.argv[0])
url = "http://api.twitter.com/1/statuses/show/%s.json" % sys.argv[1]
response = urllib.urlopen(url)
jsontxt = response.read()
print json.dumps(json.loads(jsontxt), sort_keys=True, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment