This commit is contained in:
saret
2023-05-02 14:46:22 +03:00
2 changed files with 43 additions and 40 deletions

View File

@@ -1,2 +1,12 @@
# BulkBooks
# Bulk Books:
This script's goal is to help you to download books from [Kotar](https://kotar.cet.ac.il/).
## How To?
1. You need an Academic Access to Kotar.
1. You need to have python>=3.9
1. download the requiremetns. (It might be prefered by using venv).
1. Add the links to the __BooksToDownload__ file.
1. Run the script.
Enjoy.

View File

@@ -21,6 +21,8 @@ Books = []
THREADS = []
PATHS = []
OLD_REMOVE = []
BROWSER_PREFENCES = {"browser.download.folderList": 2, "browser.download.manager.showWhenStarting": False, "browser.download.dir": "ignore", "browser.helperApps.neverAsk.saveToDisk": "attachment/csv, text/plain, application/octet-stream, application/binary, text/csv, application/csv, application/excel, text/comma-separated-values, text/xml, application/xml, application/xls, excel/xls, application/excel 97-2003,application/Microsoft Excel 97-2003 Worksheet, application/vnd.ms-excel", "browser.helperApps.neverAsk.openFile":
"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", "browser.download.panel.shown": False}
def remove_text(text: str):
@@ -153,25 +155,16 @@ def open_firefox(url: str):
def give_me_web():
options = webdriver.FirefoxOptions()
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList", 2)
fp.set_preference("browser.download.manager.showWhenStarting", False)
fp.set_preference("browser.download.dir", "ignore")
fp.set_preference(
"browser.helperApps.neverAsk.saveToDisk",
"attachment/csv, text/plain, application/octet-stream, application/binary, text/csv, application/csv, application/excel, text/comma-separated-values, text/xml, application/xml, application/xls, excel/xls, application/excel 97-2003,application/Microsoft Excel 97-2003 Worksheet, application/vnd.ms-excel")
fp.set_preference(
"browser.helperApps.neverAsk.openFile",
"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)
for key,val in BROWSER_PREFENCES:
fp.set_preference(key, val)
options.add_argument('--lang=EN')
options.headless = True
fire = "geckodriver"
return (fp, fire, options)
if __name__ == "__main__":
with open("BooksToDownload", "r", encoding="utf_8") as file:
books = file.read().split("\n")
for b in books:
if b.find('````') > -1 and not b.startswith("#"):
OLD_REMOVE.append(b)