Skip to content

Instantly share code, notes, and snippets.

@vshivam
Last active October 7, 2015 00:58
Show Gist options
  • Select an option

  • Save vshivam/3080345 to your computer and use it in GitHub Desktop.

Select an option

Save vshivam/3080345 to your computer and use it in GitHub Desktop.
Download songs from songs.pk
import urllib
import re
def songspk(movie_name):
movie_name = "_".join(movie_name.split())
print movie_name
first_char = movie_name[0:1]
movie_list_url = "http://www.songspk.name/" + first_char.lower()+"_list.html"
print movie_list_url
source = urllib.urlopen(movie_list_url).read()
reg = movie_name.lower()+".*.html"
print reg
regex = re.compile(reg)
list = regex.findall(source)
print list
movie_page_source = urllib.urlopen("http://songspk.name/"+list[0]).read()
reg_song_name = "http://link[0-9]*\.songspk\.name/song[0-9]*\.php\?songid=[0-9]*"
regex_2 = re.compile(reg_song_name)
list_2 = regex_2.findall(movie_page_source)
print list_2
count=2
for i in list_2:
urllib.urlretrieve(i, "/home/shivam/songs/song_"+str(count)+".mp3")
count=count+1
songspk("hum dil de")
@vshivam
Copy link
Author

vshivam commented Jul 10, 2012

  1. Songs are by default saved in the C Drive
  2. Movie names should be correct even if incomplete. Eg : Hum Dil De will suffice for Hum Dil De Chuke Sanam
  3. Downloading depends on your Internet Speed !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment