Repository navigation
Expand file tree
/
Copy path_main.py
More file actions
58 lines (33 loc) · 1.74 KB
/
Copy path_main.py
File metadata and controls
58 lines (33 loc) · 1.74 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from credentials.credentials import email, password
from utils_generic import ActionHandler, setup_driver
from procedures.obtain_cardsets import get_all_cardsets, cardsets_information
from procedures.process_cardset import extract_cardsets
# - - - CONFIGURATION - - -
URL = "https://buffl.co" # Replace with your target URL - buffl.co uses posthog, which should be disabled via setup_driver
# - - - - - -
def main():
driver = setup_driver(URL, headless=False) # Set headless=False to see and interact with the browse
handler = ActionHandler(driver, wait_time=1)
# - - - LOGIN - - -
handler.action_by("class", "TopNav_login__mpeOl", "click", "Login Button")
handler.action_by("name", "email", f"w-{email}", "Email Input", wait_overwrite=0.25)
handler.action_by("name", "password", f"w-{password}", "Password Input", wait_overwrite=0.25)
handler.action_by("class", "login-btn", "click", "Login Submit Button")
print("\n____________________________________________________________\n")
# - - - COURSES & CARDSETS- - -
cardsets = get_all_cardsets(handler)
print(cardsets_information(cardsets))
print("\n____________________________________________________________'n")
# - - - EXPORT CARDSETS - - -
extract_cardsets(handler, cardsets)
# print(extraction_information(results))
print("\n____________________________________________________________\n")
# - - - SAVE RESULTS - - -
# with open("cardsets_data.json", "w", encoding="utf-8") as f:
# json.dump(results, f, ensure_ascii=False, indent=4)
# - - - END - - -
input("If you hit 'Enter', the browser will close and the script will exit.")
driver.quit()
# - - - - - -
if __name__ == "__main__":
main()