Automated Programmatic Website Screenshots in R with {webshot} [Video Tutorial]

April 30, 2020
By

[This article was first published on r-bloggers on Programming with R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In this video tutorial, We explore the R package {webshot} by Winston Chang. This package internally uses phantom js to capture screenshot of web pages / websites, Shiny Applications, RMarkdown documents.

{webshot} also lets you take screenshot of a particular viewport or a section of website selected by css selector.

Youtube: https://youtu.be/oQKwd1cgiq4

Please subscribe and leave a comment if you have any feedback. I’m new for this Video making so any suggestion/feedback to improve would be a great benefit!

Please create an R project before trying this out, it makes life simpler in dealing with directories.

Code

Install package from CRAN using install.packages("webshot"). Reference – https://github.com/wch/webshot

library(webshot)

# webshot::install_phantomjs()

webshot(url = "https://news.ycombinator.com/", file = "hn.png",
        zoom = 2)


webshot(url = "https://news.ycombinator.com/", file = "hn.pdf")

webshot(url = "https://www.anaconda.com/",
        selector = ".hero-main",
        file = "anaconda.png")

To leave a comment for the author, please follow the link and comment on their blog: r-bloggers on Programming with R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)