Do this before class

Solve chapters Web scraping with XPATHs and CSS Web Scraping and Final Case Study at DataCamp. Read the selectorgadget vignette.

During class

IMPORTANT: The lack of an open API on a web site may indicate that the host is reluctant to share data. Respect this by not republishing their data without consent, see katalogskyddet for the Swedish legal rights.

Note that there is also a R package robotstxt, which uses an informal standard for specifying up to what degree scraping etc. is allowed on a website. Check the pkg vignette for further information.

Bokus top sellers

Scrape title, author, rating, price, … on books listed at pockettoppen (some may be extracted with html_text, others with html_attr).

SHL players

SVT news

Scrape the headlines at https://www.svt.se/.