-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjacket_collect.py
More file actions
56 lines (46 loc) · 1.36 KB
/
jacket_collect.py
File metadata and controls
56 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import grequests
import requests
import random
import time
from song_collector import*
from bs4 import BeautifulSoup as bs
img_file = []
img_jacket = []
remove_list = []
def jacket():
index_num = 0
reqs = (grequests.get(song) for song in remy_links)
resp = grequests.map(reqs)
for response in resp:
soup2 = bs(response.content, 'lxml')
try:
fileclass = soup2.find('div', class_= 'thumbinner')
filelink = fileclass.find('a', href = True)
wrem = remy_url + filelink['href']
img_file.append(wrem)
print(wrem)
index_num += 1
except AttributeError:
remove_list.append(index_num)
index_num += 1
pass
for index in remove_list:
del remy_links[index]
del titles[index]
def image():
reqs = (grequests.get(img) for img in img_file)
resp = grequests.map(reqs)
for response in resp:
soup3 = bs(response.content, 'lxml')
try:
fileclass = soup3.find('div', class_= 'fullImageLink')
filelink = fileclass.find('a', href = True)
wrem = remy_url + filelink['href']
img_jacket.append(wrem)
print(wrem)
except AttributeError:
pass
linklist()
song_title()
jacket()
image()