Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Created November 14, 2022 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toyeiei/4989e7383f63365e2ba480fd62f6a3c0 to your computer and use it in GitHub Desktop.
Save toyeiei/4989e7383f63365e2ba480fd62f6a3c0 to your computer and use it in GitHub Desktop.
datarockie blog - web scraping specphone example
library(tidyverse)
library(rvest)
url <- "https://specphone.com/Samsung-Galaxy-S22.html"
web <- read_html(url)
topics <- web %>%
html_nodes("div.topic") %>%
html_text()
details <- web %>%
html_nodes("div.detail") %>%
html_text()
df <- data.frame(topics, details)
View(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment