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

Wants to extract the html of the whole document but kept getting no node found #59

Closed
jslearn81 opened this issue Jul 20, 2021 · 3 comments

Comments

@jslearn81
Copy link

jslearn81 commented Jul 20, 2021

Hi there,

Thanks for creating the package. I think it is super awesome and will be useful for webscrapping.
I kept getting this error:

'Error in onRejected(reason) : code: -32000
message: No node found for given backend id'

My sample code is:

`
library(chromote)

b <- ChromoteSession$new()

b$view()

b$Page$navigate("https://sc.macromicro.me/charts/449/us-cboe-options-put-call-ratio",wait_ = TRUE) #as they block CORS

Sys.sleep(3)

b$Page$navigate("https://sc.macromicro.me/charts/data/449",wait_ = TRUE)

data <- b$DOM$getDocument()

data_content <- b$DOM$getOuterHTML(data$root$nodeId)

json_data <- stringr::str_extract_all(data_content,'\{(.*|\n)?\}')[[1]]

json_data <- fromJSON(json_data)

b$close()
`

Any tips to get this working ? Or is there a better command to extract the content of the page ?

Regards
J

@jslearn81
Copy link
Author

Hi did i get anyone's attention so far :( ?

@RLesur
Copy link
Contributor

RLesur commented Aug 11, 2021

Hi @quantumfusionlearn ,

You can try something like that:

json_data <- jsonlite::fromJSON(xml2::xml_text(xml2::read_html(data_content$outerHTML)))

@hadley
Copy link
Member

hadley commented Jan 30, 2024

I'm about to add support live scraping via chromote to rvest: tidyverse/rvest#362. That will be more user facing (rather than developer) and I'll be actively looking for scraping challenges.

@hadley hadley closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants