Говнокод остался говнокодом

This commit is contained in:
tema 2022-02-18 13:38:22 +02:00
parent ebae53a81c
commit 617b503a3b
Signed by: tema
GPG Key ID: 21FDB6D162488F6F
2 changed files with 7 additions and 7 deletions

View File

@ -45,10 +45,10 @@ def docs_parse():
except Exception: pass except Exception: pass
try: output = one_parser(soup, output); #print(output) try: output = one_parser(soup, output); #print(output)
except Exception: pass except Exception: pass
try: output = parser_two(soup, output); print(output) try: output = parser_two(soup, output); #print(output)
except Exception as e: raise(e) #except Exception as e: pass
#try: output = parser3(soup, output); print(output) #try: output = parser3(soup, output); print(output)
#except Exception as e: raise(e) except Exception as e: raise(e)
with open(config.data_file, 'w') as f: with open(config.data_file, 'w') as f:

View File

@ -24,14 +24,14 @@ def table_parser(soup, output):
def one_parser(soup, output): def one_parser(soup, output):
raw_data = soup.find("main").findAll("p") raw_data = soup.find("main").findAll("p")
date = ( date = (
raw_data[3].find("span", style="font-size:16px;").b.text.lower() raw_data[3].text.lower()
.replace(u"\xa0", u"").replace("на", "").replace("\r", "") .replace(u"\xa0", u"").replace("на", "").replace("\r", "")
.replace("ЗАМІНИ ДО РОЗКЛАДУ".lower(), "").split("\n") .replace("ЗАМІНИ ДО РОЗКЛАДУ".lower(), "").split("\n")
) )
output["date"] = date[1].lstrip(" ") output["date"] = date[0].lstrip(" ")
for p in raw_data[4].find("span",style="font-size:16px;").b.text.replace(u"\xa0", u"").split("\n"): for p in raw_data[4].text.replace(u"\xa0", u"").split("\n"):
p = p.lstrip(" ") if p == "": continue
data_rep = (p.lstrip(" ").split(" ", 1)) data_rep = (p.lstrip(" ").split(" ", 1))
group = data_rep[0] group = data_rep[0]
text = data_rep[1].replace("\r", "").lstrip(" ") text = data_rep[1].replace("\r", "").lstrip(" ")