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(" ")