From 617b503a3b1b9dbc7ec56f2235bf8e5c3977ded7 Mon Sep 17 00:00:00 2001 From: tema Date: Fri, 18 Feb 2022 13:38:22 +0200 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BE=D0=B2=D0=BD=D0=BE=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=20=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D1=81=D1=8F=20=D0=B3?= =?UTF-8?q?=D0=BE=D0=B2=D0=BD=D0=BE=D0=BA=D0=BE=D0=B4=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parser/parser.py | 6 +++--- parser/utils.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/parser/parser.py b/parser/parser.py index 6bf3fa8..28d066e 100644 --- a/parser/parser.py +++ b/parser/parser.py @@ -45,10 +45,10 @@ def docs_parse(): except Exception: pass try: output = one_parser(soup, output); #print(output) except Exception: pass - try: output = parser_two(soup, output); print(output) - except Exception as e: raise(e) + try: output = parser_two(soup, output); #print(output) + #except Exception as e: pass #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: diff --git a/parser/utils.py b/parser/utils.py index e81ddb4..933d6ca 100644 --- a/parser/utils.py +++ b/parser/utils.py @@ -24,14 +24,14 @@ def table_parser(soup, output): def one_parser(soup, output): raw_data = soup.find("main").findAll("p") 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("ЗАМІНИ ДО РОЗКЛАДУ".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"): - p = p.lstrip(" ") + for p in raw_data[4].text.replace(u"\xa0", u"").split("\n"): + if p == "": continue data_rep = (p.lstrip(" ").split(" ", 1)) group = data_rep[0] text = data_rep[1].replace("\r", "").lstrip(" ")