Skip to content

Instantly share code, notes, and snippets.

@felixhummel
Created November 22, 2013 11:00
Show Gist options
  • Save felixhummel/7598124 to your computer and use it in GitHub Desktop.
Save felixhummel/7598124 to your computer and use it in GitHub Desktop.
#!/bin/bash
[[ $1 == 'skip' ]] || wget -c http://dir.xiph.org/yp.xml
python<<'EOF'
from lxml import etree
t = etree.parse(open('yp.xml'))
def urls_by_genre(genre):
xpath = """//entry[contains(genre, '{0}')]""".format(genre)
return [e.find('listen_url').text for e in t.xpath(xpath)]
print '\n'.join(urls_by_genre('smooth'))
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment