initial commit
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
from zlib_dl import ZLibSession
|
||||
import re
|
||||
from bs4 import BeautifulSoup
|
||||
s = ZLibSession(verbose=True)
|
||||
url = "https://zlib.li/book/mDJxkg7yO6/%E6%B5%AA%E6%BD%AE%E4%B9%8B%E5%B7%85%E7%AC%AC%E5%9B%9B%E7%89%88.html"
|
||||
resp = s._request_download(url)
|
||||
soup = BeautifulSoup(resp.text, 'html.parser')
|
||||
a_tag = soup.find('a', href=re.compile(r"^/dl/\w+"))
|
||||
if a_tag:
|
||||
print(f"FOUND: {a_tag['href']}")
|
||||
else:
|
||||
print("NOT FOUND")
|
||||
# let's try another heuristic
|
||||
dl_btn = soup.find('a', class_=re.compile(r"addDownloadedBook"))
|
||||
if dl_btn:
|
||||
print("FOUND VIA CLASS:", dl_btn.get("href"))
|
||||
else:
|
||||
print("STILL NOT FOUND")
|
||||
Reference in New Issue
Block a user