Skip to content

Commit

Permalink
Fix: Python handler Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
n0c3Nz committed Nov 24, 2024
1 parent d65e600 commit 5a7e465
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/backend/scraping.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ async def collect_scraped_elements(page: tuple[str, str], xpaths: list[Element])
el = sxpath(root, elem.xpath)

for e in el:
text = "\t".join(str(t) for t in e.itertext())
if isinstance(e, etree._Element):
text = "\t".join(str(t) for t in e.itertext())
else: # Es un texto directamente
text = str(e)
captured_element = CapturedElement(
xpath=elem.xpath, text=text, name=elem.name
)
Expand Down

0 comments on commit 5a7e465

Please sign in to comment.