knitr::opts_chunk$set(echo = TRUE)
In this example, I am interested in scraping the last tweets of a given webpage.
To do so, I will:
reticulate::use_condaenv("pw", required = TRUE) options(python_init = TRUE) library(reticulate) library(playwrightr) library(dplyr)
twitter_handle <- "elonmusk" chrome <- new_browser("chrome", headless = F) page <- chrome$pages[[1]]
page$goto(glue::glue("https://twitter.com")) page$goto(glue::glue("https://twitter.com/{twitter_handle}"))
page$screenshot(path = "test.png")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.