Compare commits

...

4 Commits

Author SHA1 Message Date
29f6324bc2 Merge pull request 'master' (#2) from Mooooooooo/BulkBooks:master into master
Reviewed-on: https://git.saret.tk/saret/BulkBooks/pulls/2
2023-04-25 12:22:46 +03:00
work
7fc8519e4a path location 2023-04-25 12:20:06 +03:00
work
8cbdcee256 headless 2023-04-25 12:17:03 +03:00
d9dfaaa68c preformence improvement 2023-04-25 12:11:12 +03:00
2 changed files with 10 additions and 5 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,3 @@
.vscode/
venv/
venv/
ignore/

View File

@@ -76,7 +76,10 @@ def do_action_now(index: int):
files = list(SOURCES[index])
for s in SOURCES[index]:
if SOURCES[index][s]:
files[files.index(s)] = urllib3.PoolManager().request("GET", SOURCES[index][s]).data
if not os.path.exists(f"ignore/{name}/{files.index(s):04}.jpg"):
with open(f"ignore/{name}/{files.index(s):04}.jpg","wb") as F:
F.write(urllib3.PoolManager().request("GET", SOURCES[index][s]).data)
# files[files.index(s)] = urllib3.PoolManager().request("GET", SOURCES[index][s]).data
return files
# def check_and_act(index: int,last):
@@ -110,15 +113,15 @@ def act_now(index: int, path: str = None):
url_now = url_now[:url_now.find("#")+1] + save_first
if SOURCES[index][last] and "" in SOURCES[index].values():
ACTS[index]._driver.get(url_now)
pages = do_action_now(index)
do_action_now(index)
SOURCES[index][last] = ""
else:
pages = do_action_now(index)
do_action_now(index)
if SOURCES[index] and "" not in SOURCES[index].values():
couters += 1
pathus = f'{path}/{name}.pdf' if path else f"ignore/{name}/{name}.pdf"
with open(pathus, "wb") as file:
file.write(img2pdf.convert(pages))
file.write(img2pdf.convert(glob.glob(f"ignore/{name}/*jpg")))
ACTS[index]._driver.quit()
remove_text(OLD_REMOVE[index])
treads -= 1
@@ -161,6 +164,7 @@ def give_me_web():
"application/PDF, application/FDF, application/XFDF, application/LSL, application/LSO, application/LSS, application/IQY, application/RQY, application/XLK, application/XLS, application/XLT, application/POT application/PPS, application/PPT, application/DOS, application/DOT, application/WKS, application/BAT, application/PS, application/EPS, application/WCH, application/WCM, application/WB1, application/WB3, application/RTF, application/DOC, application/MDB, application/MDE, application/WBK, application/WB1, application/WCH, application/WCM, application/AD, application/ADP, application/vnd.ms-excel")
fp.set_preference("browser.download.panel.shown", False)
options.add_argument('--lang=EN')
options.headless = True
fire = "geckodriver"
return (fp, fire, options)