Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. from urllib.request import urlretrieve as get
  2. import re,sys
  3. from bs4 import BeautifulSoup as soup
  4. def get_songs(src):
  5. songs = src.find_all("div", class_="play_btn fl_l")
  6. if not songs:
  7. print ("There are not songs for you, sorry")
  8. for song in songs:
  9. link = song.find("input").get("value")
  10. link = pattern.search(link).group(0)
  11. destination = link.rsplit('/',1)[1]
  12. get(link, destination)
  13. print("Plus 1 song in your collection")
  14. if __name__ == '__main__':
  15. souped = soup(open(sys.argv[1]).read())
  16. pattern = re.compile(r"^.*\.mp3")
  17. get_songs(souped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement