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

rvest fails to parse HTML page from google scholar; returns xml_nodeset (0) #383

Closed
Rohit-Satyam opened this issue Jan 10, 2024 · 2 comments

Comments

@Rohit-Satyam
Copy link

Rohit-Satyam commented Jan 10, 2024

Hi @hadley

rvest v 1.0.3 was working just fine a few hours ago and suddenly it stopped working. I was trying to scrap some paper titles using a gene ID on Google Scholar and it was doing a good job but now I get xml_nodeset (0)

    url <- paste0("https://scholar.google.com/scholar?q=", "PF3D7_0420300")
    
    # Fetch the HTML content of the search results page
    page <- rvest::read_html(url)
    
    # Extract titles and publication years
    titles <- page %>%
      rvest::html_nodes(".gs_rt a") %>%
      rvest::html_text() %>%
      trimws()

Even code chunk given here returns empty results:

image

@Rohit-Satyam
Copy link
Author

I tried rvest on my laptop and it's working. This is weird. Is it something related to multiple queries emanating from single IP?

@hadley
Copy link
Member

hadley commented Jan 10, 2024

It's almost certainly because some automated system is trying to block you from scraping.

@hadley hadley closed this as completed Jan 10, 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

2 participants