Skip to content

Instantly share code, notes, and snippets.

@jemus42
Created December 15, 2016 22:09
Show Gist options
  • Save jemus42/a9e1fce7229fa01c51cafd0df04475c2 to your computer and use it in GitHub Desktop.
Save jemus42/a9e1fce7229fa01c51cafd0df04475c2 to your computer and use it in GitHub Desktop.
Simple amazon scraper with slack notification because @danjel
library(rvest) # Parse HTML
library(httr) # Send POST request, I think rvest depends on that anyway
url <- "https://www.amazon.de/dp/B01M0LHEZI"
slack_url <- "somewebhookurlimtoolazytoget"
avail <- read_html(url) %>%
html_node("#availability :first-child") %>%
html_text(trim = T)
if (grepl(avail, pattern = "Lager")) {
POST(url = slack_url,
body = list(text = "Kopfhörer sind verfügbar!"),
encode = "json")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment