Skip to content

Commit e0f9abd

Browse files
authored
Fixed Issue NadalVRoMa#6
1 parent a56a1da commit e0f9abd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pylibgen.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,22 @@ def default_mirror(link, filename):
175175
req = request.Request(link, headers=DownloadBook.headers)
176176
source = request.urlopen(req)
177177
soup = BeautifulSoup(source, 'lxml')
178+
mother_link = "https://libgen.pw"
178179

179180
for a in soup.find_all('a'):
180-
if a.text == 'GET':
181-
download_url = a.attrs['href']
181+
if a.text == 'Open download':
182+
item_url = a.attrs['href']
183+
getpage_url = mother_link + item_url
184+
req2 = request.Request(getpage_url, headers=DownloadBook.headers)
185+
source2 = request.urlopen(req2)
186+
soup2 = BeautifulSoup(source2, 'lxml')
187+
188+
for a in soup2.find_all('a'):
189+
if a.text == 'Get':
190+
download_url = mother_link + a.attrs['href']
182191
break
183192

193+
184194
if os.path.exists(DOWNLOAD_PATH) and os.path.isdir(DOWNLOAD_PATH):
185195
print('Downloading...')
186196
path = '{}/{}'.format(DOWNLOAD_PATH, filename)

0 commit comments

Comments
 (0)