diff --git a/get_definitions.py b/get-definitions.py similarity index 94% rename from get_definitions.py rename to get-definitions.py index 791d936..d084d55 100644 --- a/get_definitions.py +++ b/get-definitions.py @@ -1,5 +1,6 @@ import os import sys +import time import urllib.parse from pathlib import Path @@ -26,6 +27,7 @@ def main(): else: start_from = "" get_definitions(form) + time.sleep(5000) except OSError: exit("Could not open forms list file.") @@ -39,8 +41,7 @@ def get_definitions(form): # Check other definitions. tabs_bar = soup.find("div", id="vtoolbar") if not tabs_bar: - sys.stderr.write("No tabs bar!\n") - return + exit("No tabs bar!\n") num_defs = len(tabs_bar("li")) for variant in range(1, num_defs): # skip the first, we got it above. variant_url = url + f"/{variant}" @@ -60,8 +61,7 @@ def get_page(url): def process_definition_page(soup, form, variant): definition = soup.find("div", id="lexicontent") if not definition: - sys.stderr.write("No definition!\n") - return + exit("No definition!\n") save_definition(form, variant, definition.prettify())