35 lines
921 B
Python
35 lines
921 B
Python
# pip install playwright
|
|
# pip install pytest-playwright
|
|
# playwright install
|
|
import json
|
|
from playwright.sync_api import sync_playwright
|
|
import tqdm
|
|
|
|
from login import login
|
|
from get_names import get_names
|
|
from get_main import get_main
|
|
from grep_subpages import grep_subpages
|
|
|
|
|
|
with open("config.json") as config_file:
|
|
config_data = json.load(config_file)
|
|
base = config_data["base"]
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch()
|
|
page = browser.new_page()
|
|
|
|
login(page, config_data)
|
|
|
|
list_entries: list[tuple[str, str]] = get_names(page, config_data)
|
|
assert len(list_entries) > 0
|
|
|
|
for idx in tqdm.trange(0, len(list_entries)):
|
|
list_sub_entries: list[tuple[str, str]] = get_main(
|
|
page, config_data, list_entries[idx]
|
|
)
|
|
grep_subpages(
|
|
page, config_data, list_sub_entries, path_name=list_entries[idx][0]
|
|
)
|
|
|
|
browser.close()
|