Last active 1444397284

Lyrics getter

Revision 6e103738450c1763645b7f057051bd1b4afeb111

lyrics.py Raw
1import urllib,re,sys;
2from BeautifulSoup import BeautifulSoup
3inp = str(sys.argv[1])
4a = urllib.urlopen("http://www.azlyrics.com/lyrics/" + inp + ".html").read()
5soup = BeautifulSoup(a)
6b = soup.findAll(style="margin-left:10px;margin-right:10px;")
7c = str(b).replace("[<div", "<div")
8c = c.replace("</div>]", "</div>")
9meta = inp.split("/")
10file = open(meta[0] + " - " + meta[1] + ".html", "w")
11file.write(c)
12file.close()
13print "Success. Lyrics written to " + file.name