2022-10-07 17:50:42 +03:00
|
|
|
from bs4 import BeautifulSoup
|
2022-02-16 18:13:44 +03:00
|
|
|
|
2022-10-07 17:50:42 +03:00
|
|
|
def table_parser(soup: BeautifulSoup, output):
|
2022-02-16 18:13:44 +03:00
|
|
|
#Date parser
|
|
|
|
date = (soup.find("main").findAll('span', style="color:black"))[1]
|
|
|
|
output["date"] = date.text.replace(u'\xa0', u'')
|
|
|
|
|
|
|
|
|
|
|
|
#Replaces parser
|
|
|
|
replaces = soup.findAll('tr')
|
|
|
|
for data in replaces:
|
|
|
|
|
|
|
|
text = (
|
|
|
|
data.find("td", valign="top")
|
|
|
|
.find("span", style="color:black")
|
|
|
|
.text.replace(u'\xa0', u'')
|
|
|
|
)
|
|
|
|
group = (
|
|
|
|
data.find("span", style="color:black")
|
|
|
|
.text.replace(" ", "").replace(u'\xa0', u''))
|
|
|
|
output["data"][group] = text
|
|
|
|
|
|
|
|
return output
|
|
|
|
|
|
|
|
|
2022-10-07 17:50:42 +03:00
|
|
|
def image_parser(soup: BeautifulSoup):
|
|
|
|
main = soup.find("p", style="text-align:center; margin:0cm 0cm 8pt")
|
|
|
|
image = main.select_one('img[src$=".jpg"]')
|
|
|
|
output = image['src']
|
2022-02-16 18:13:44 +03:00
|
|
|
|
|
|
|
return output
|