Skip to content

Commit a9a293a

Browse files
committed
Update songs.py
1 parent b4b5142 commit a9a293a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

songs.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
1-
#The file downloads songs all audio songs from "http://www.linkersweddingsolutions.com/weddingsongs/list-of-wedding-songs-from-hindi-movies.html":
2-
#Work in progress
31
from bs4 import BeautifulSoup
42

53
import urllib2
6-
74
response = urllib2.urlopen('http://www.linkersweddingsolutions.com/weddingsongs/list-of-wedding-songs-from-hindi-movies.html')
85
html = response.read()
96
links = []
7+
rows = []
108

119
soup = BeautifulSoup(html)
10+
11+
table = soup.find('table', {'class': 'download'})
12+
13+
for row in table.findAll('tr'):
14+
matter = row.findAll('td')
15+
print 'matter is', matter.prettify()
16+
17+
"""
18+
rows.append(matter[0].contents)
19+
links.append(matter[3])
20+
21+
key = str(row[::1])
22+
links[key] = row[::3]
1223
soup = soup.select('a[href^="http://www.mymp3singer.com/get.php?"]')
1324
for link in soup:
1425
links.append(str(link['href']))
1526
16-
# work here
1727
response = urllib2.urlopen(links[0])
1828
html = response.read()
1929
2030
print 'response is', response.info()
2131
file_size_dl = 0
22-
bufferSize = 8192
32+
33+
2334
f = open('testFile.mp3', 'wb')
2435
while True:
25-
buffer = response.read(bufferSize)
36+
buffer = response.read(8192)
2637
if not buffer:
2738
break
2839
2940
file_size_dl += len(buffer)
3041
f.write(buffer)
3142
f.close()
43+
"""

0 commit comments

Comments
 (0)