Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can’t scrap untagged html element #266

Open
Flashby2 opened this issue Mar 28, 2024 · 1 comment
Open

Can’t scrap untagged html element #266

Flashby2 opened this issue Mar 28, 2024 · 1 comment

Comments

@Flashby2
Copy link

Hello,

I'm in a rather tricky situation because after numerous unsuccessful attempts and searches, I'm unable to retrieve the following element, which seems quite trivial. I'm trying to retrieve the string "2h43", but it doesn't seem to belong to any nodes. I've tried testing the outerHTML and the different siblings, but to no avail.

let html = "<strong><u>Durée</u> : </strong>02h43<br>"

Here's my line that should work:

let element: Element = try doc.select("strong:contains(Durée)").first()!

let durationText = try element.nextElementSibling()!.text()
@aehlke
Copy link
Collaborator

aehlke commented Dec 11, 2024

still an issue? please submit a PR to fix this... trace what the contains code does in the code base, it's readable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants