Skip to content

Instantly share code, notes, and snippets.

@alaingilbert
Created February 9, 2012 22:01
Show Gist options
  • Save alaingilbert/1783647 to your computer and use it in GitHub Desktop.
Save alaingilbert/1783647 to your computer and use it in GitHub Desktop.
import urllib2, urllib, re, sys
def main():
if not len(sys.argv) > 1:
print "You shall give a genre. example: python band.py house"
return
keyword = sys.argv[1]
res = []
html = urllib2.urlopen('http://www.bandnamemaker.com/generator/?cw=%s' % keyword).read()
li = re.search('<ul id="generator-results">(.+)</ul>', html, re.DOTALL)
if li:
li = li.group(1).replace('\n', '')
res = re.findall('<li>(.+?)</li>', li)
print res
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment