get-definitions: slow down big boy
This commit is contained in:
parent
fb43e28c6e
commit
da64b59cfb
|
@ -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())
|
||||
|
||||
|
Loading…
Reference in a new issue