Fix links outside tables

This commit is contained in:
I-Al-Istannen 2020-11-04 14:38:15 +01:00
parent f4abe3197c
commit 0da2fafcd8

View File

@ -86,9 +86,10 @@ class IpdCrawler:
href: str = link.attrs.get("href")
name = href.split("/")[-1]
modification_date: Optional[datetime.datetime]
modification_date: Optional[datetime.datetime] = None
try:
enclosing_row: bs4.Tag = link.findParent(name="tr")
if enclosing_row:
date_text = enclosing_row.find(name="td").text
modification_date = datetime.datetime.strptime(date_text, "%d.%m.%Y")
except ValueError: