mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Fix links outside tables
This commit is contained in:
parent
f4abe3197c
commit
0da2fafcd8
@ -86,11 +86,12 @@ class IpdCrawler:
|
|||||||
href: str = link.attrs.get("href")
|
href: str = link.attrs.get("href")
|
||||||
name = href.split("/")[-1]
|
name = href.split("/")[-1]
|
||||||
|
|
||||||
modification_date: Optional[datetime.datetime]
|
modification_date: Optional[datetime.datetime] = None
|
||||||
try:
|
try:
|
||||||
enclosing_row: bs4.Tag = link.findParent(name="tr")
|
enclosing_row: bs4.Tag = link.findParent(name="tr")
|
||||||
date_text = enclosing_row.find(name="td").text
|
if enclosing_row:
|
||||||
modification_date = datetime.datetime.strptime(date_text, "%d.%m.%Y")
|
date_text = enclosing_row.find(name="td").text
|
||||||
|
modification_date = datetime.datetime.strptime(date_text, "%d.%m.%Y")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
modification_date = None
|
modification_date = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user