Skip to content

Commit

Permalink
fix type check in handle_image
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyInnowhere authored and CodyInnowhere committed Dec 2, 2024
1 parent 48edfa1 commit 67fa32b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion trafilatura/main_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,11 @@ def handle_table(table_elem: _Element, potential_tags: Set[str], options: Extrac
return None


def handle_image(element: _Element) -> Optional[_Element]:
def handle_image(element: Optional[_Element]) -> Optional[_Element]:
"Process image elements and their relevant attributes."
if element is None:
return None

processed_element = Element(element.tag)

for attr in ("data-src", "src"):
Expand Down

0 comments on commit 67fa32b

Please sign in to comment.