Laad libraries
library(httr) # om data uit de API te krijgen
library(htmltools) # voor html te genereren
Vraag info op over OGAO-collectie
collection <- content(GET("https://raindrop.io/v1/collection/1051032"))
bookmarks <- content(GET("https://raindrop.io/v1/bookmarks/1051032"))
Access collection en bookmarks-data as R-objects
collection$item$title # print titel van collectie
## [1] "HIVA Arbeid en Organisatie"
length(bookmarks$items) # aantal bookmarks
## [1] 9
bookmarks$items[[2]]$title # title v/d 2e bookmark
## [1] "Doe niet mee met vakbond en je krijgt extra dag vakantie en smartphone"
paste(bookmarks$items[[2]]$tags) # tags v/d 2e bookmark
## [1] "uitzendsector" "sociale verkiezingen" "vakbond"
## [4] "fascisme"
Genereer quick-n-dirty HTML-stukje met links
cat(paste0('<strong>Bookmarks voor collectie van ',
collection$item$title, ':</strong>'))
cat('<ul>')
for (item in bookmarks$items) {
cat('<li>')
cat(paste0('<a href="', htmlEscape(item$link), '">'))
cat(item$title)
cat(paste0('</a>'))
cat('</li>')
}
cat('<ul>')
Resultaat output HTML-stukje
Bookmarks voor collectie van HIVA Arbeid en Organisatie: