This commit is contained in:
tema 2022-11-14 17:53:04 +02:00
parent 66283e0730
commit 7b5af42082
Signed by: tema
GPG Key ID: 21FDB6D162488F6F

View File

@ -1,4 +1,5 @@
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from typing import Any
def table_parser(soup: BeautifulSoup, output): def table_parser(soup: BeautifulSoup, output):
#Date parser #Date parser
@ -24,8 +25,10 @@ def table_parser(soup: BeautifulSoup, output):
def image_parser(soup: BeautifulSoup): def image_parser(soup: BeautifulSoup):
image: Any
extension = ('png', 'jpg')
main = soup.find("main") main = soup.find("main")
image = main.select('img[src$=".png"]') for ext in extension:
output = image[0]['src'] image = main.select(f'img[src$=".{ext}"]')
if image:
return output return image[0]['src']