The website Privacy Affairs keeps a list of fines related to GDPR.
I heard * that this might be an interesting dataset for TidyTuesdays. The dataset contains at this
moment 250 fines given out for GDPR violations and is last updated (according to the website) on 31 March 2020.

All data is from official government sources, such as official reports of national Data Protection Authorities.

The largest fine is €50,000,000 on Google Inc. on January 21 , 2019 – in France, and the smallest is actually 0 euros, but the website says 90.

Scraping

I use the {rvest} package to scrape the website.

Before you start

I first checked the robots.txt of this website. And it
did not disallow me to scrape the website.

The scraping

I thought this would be easy and done in a minute. But there were some snafus.
It works for now, but if the website changes a bit this scraping routine will not work that well anymore. It extracts the script part of the website and extracts the data between ‘[’ and ’]’.
If anyone has ideas on making this more robust, be sure to let me know over twitter.

Details about the scraping part

First I noticed that the website doesn’t show you all of the fines. But when we look at the source of the page it seems they are all there. It should be relatively simple to retrieve the data, the data is
in the javaScript part (see picture).

Image of sourcecode of the website

But extracting that data is quite some more work:

First find the < script > tag on the website

Find the node that contains the data

Realize that there are actually two datasources in here

library(rvest)

## Loading required package: xml2

link% html_nodes("script") %>% .[9] %>%
rvest::html_text()

cry (joking, don’t give up! The #rstats community will help you!)

do some advanced string manipulation to extract the two json structures