-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (26 loc) · 805 Bytes
/
main.py
File metadata and controls
33 lines (26 loc) · 805 Bytes
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
from scrape.module import *
from scrape.unit import *
from scrape.login import *
from scrape.selection import *
import os
driver = login(os.getcwd())
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
hierarchy = get_units(driver)
make_selection(hierarchy)
path = os.path.join(os.getcwd(),'ada-learn')
for unit, modules in hierarchy.items():
unit_path = os.path.join(path, unit)
try:
os.mkdir(unit_path)
except:
pass
for module_name, module_link in modules.items():
module_path = os.path.join(unit_path, module_name)
os.mkdir(module_path)
driver = save_pages(module_path, module_link, driver)
print(f"{unit} has been saved!")
driver.close()
driver.quit()
# ask zip or leave as is
# if input().lower() == y:
# zip