Scraping a table from reddit in R - r

I am trying to scrape a table from reddit in R. Here is the link: https://old.reddit.com/r/hiphopheads/comments/9nocy8/twenty_one_pilots_trench_sells_170k_first_week/
I am trying to scrape the main table in the post. Here is my code:
library(rvest)
url <- "https://old.reddit.com/r/hiphopheads/comments/9nocy8/twenty_one_pilots_trench_sells_170k_first_week/"
albums <- url %>%
read_html() %>%
html_nodes(xpath ='//*[#id="form-t3_9nocy8ire"]/div/div/table') %>%
html_table()
albums
The issue is, this keeps returning me a list of 0. Any help on scraping this properly would be appreciated. Thanks!

Related

Obtaining "Character(0)" error when using rvest to get Google results headlines

Sorry if my question is simple or badly asked, I am very new at web scraping with R.
I am trying to scrape the headlines from a Google search. Sorry if it is exactly the same request previously asked in the link below, however it does not work for me (it still returns
"character(0)" ).
Character(0) error when using rvest to webscrape Google search results
Here is the two scripts I tried, based on the answers provided in the link above:
#Script 1
library(rvest)
library(dplyr)
web1 <- read_html("https://www.google.at/search?q=munich+prices")
web1 %>%
html_nodes(xpath = '//div/div/div/a/div[not(div)]') %>%
html_text
#Script 2
library(rvest)
library(dplyr)
web1 <- read_html("https://www.google.at/search?q=munich+prices")
web1 %>%
html_nodes(xpath = '//div/div/div/a/h3/div[not(div)]') %>%
html_text
The two scripts still return "character(0)" for me.
Does anyone have an idea?
Thanks you for your help.
Victor
As requested here is the screenshot,
library(rvest)
library(dplyr)
web1 <- read_html("https://www.google.at/search?q=munich+prices")
web1 %>%
html_nodes(xpath = '//div/div/div/a/h3/div[not(div)]') %>%
html_text

Rvest html_table() does not scrape all tables from webpage

I am trying to scrape a table of a webpage. However, when I use the code below I get every table, except the one I really need. Can someone help me? I am trying to get the red table (see picture).
Code:
library(rvest)
library(tidyverse)
webpage <- read_html("https://www.arbeidsmarktcijfers.nl/Report/4")
tbls_ls <- webpage %>%
html_nodes("table") %>%
html_table(fill = TRUE)
The tbls_ls object contains 49 tables. But not the red one.
Many thanks in advance!

Web scraping html table in R, but the output remains empty

I am trying to scrape the data in the table at : https://www.flashscore.com/football/france/coupe-de-la-ligue-2005-2006/results/
I wrote the following code, but the output results remains empty.
library (rvest)
url <- "https://www.soccer24.com/france/coupe-de-la-ligue-2005-2006/results/"
results <- read_html(url) %>%
html_nodes(xpath='/html/body/div[6]/div[1]/div/div[1]/div[2]/div[7]/div[3]/table') %>%
html_table()
Does anyone know why results is empty and how to scrape this table ?

Web scraping with R using rvest for financial website

I am trying to scrape data table from following website using R, but it is not returning any value. I am using SelectorGadget to get the nodes detail.
library(rvest)
url = "http://www.bursamalaysia.com/market/derivatives/prices/"
text <- read_html(url) %>%
html_nodes("td") %>%
html_text()
output:
text
character(0)
I would appreciate any kind of help. Thank you!

scraping tables with rvest in R

I'm attempting to scrape the table featuring trading data from this website: https://emma.msrb.org/IssuerHomePage/Issuer?id=F5FDC93EE0375953E043151E0A0AA7D0&type=M
This should be a rather simple process, but I run this code:
library(rvest)
url <- "https://emma.msrb.org/IssuerHomePage/Issuer?
id=F5FDC93EE0375953E043151E0A0AA7D0&type=M"
deals <- url %>%
read_html() %>%
html_nodes(xpath='//*[#id="lvTrades"]') %>%
html_table()
deals <- deals[[1]]
and I get the following error:
Error in deals[[1]] : subscript out of bounds
On top of this, it seems the scrape isn't returning any text. Any ideas on what I'm doing wrong? Sorry if this seems a little elementary, I'm relatively new to this scraping stuff.

Resources