Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from urllib.request import urlretrieve as get
- import re,sys
- from bs4 import BeautifulSoup as soup
- def get_songs(src):
- songs = src.find_all("div", class_="play_btn fl_l")
- if not songs:
- print ("There are not songs for you, sorry")
- for song in songs:
- link = song.find("input").get("value")
- link = pattern.search(link).group(0)
- destination = link.rsplit('/',1)[1]
- get(link, destination)
- print("Plus 1 song in your collection")
- if __name__ == '__main__':
- souped = soup(open(sys.argv[1]).read())
- pattern = re.compile(r"^.*\.mp3")
- get_songs(souped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement