Skip to content

Instantly share code, notes, and snippets.

@michel-slm
Created April 5, 2011 11:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michel-slm/903448 to your computer and use it in GitHub Desktop.
Save michel-slm/903448 to your computer and use it in GitHub Desktop.
iTunes feed extractor
#!/usr/bin/env python
import plistlib
import urllib2
import sys
ITUNES_VER = '7.4.1'
USER_AGENT = 'iTunes/' + ITUNES_VER
def get_props(url):
request = urllib2.Request(url)
request.add_header('User-Agent', USER_AGENT)
response = urllib2.urlopen(request)
return plistlib.readPlistFromString(response.read())
def get_feed(url):
props = get_props(url)
return props['items'][0]['feedURL']
if __name__ == '__main__':
for url in sys.argv[1:]:
print get_feed(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment