The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Introduction to diezeit

About the package

diezeit is an R wrapper for the ZEIT ONLINE Content API, available at http://developer.zeit.de. It gives access to articles and corresponding metadata from the ZEIT archive dating back to 1946 and from ZEIT ONLINE. The API can be used for free for non-commercial use cases. For the terms of use see http://developer.zeit.de/licence (German only at the moment).

A personal API key is required for usage and can be requested at http://developer.zeit.de/quickstart. Registration is free and allows for API-Access with a limit of 10,000 requests per day. If you do not want to enter your key for each R session, put the following in your .Renviron or .Rprofile file: ZEIT_KEY=PUTYOURKEYHERE.

Package install

diezeit is available on GitHub. To install it directly from R the devtools-package is required.

if(packageVersion("devtools") < 1.6) {
  install.packages("devtools")
}
devtools::install_github("chgrl/diezeit")

Load the package

library(diezeit)

Search the ZEIT archive

Get detailled metadata from the ZEIT archive

Get article metadata by ID.

zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA")
#> $teaser_title
#> [1] "Und Recht und Freibier"
#> 
#> $uuid
#> [1] "3Ed7KYJOO2MXu5SQtnudQA"
#> 
#> $title
#> [1] "Und Recht und Freibier"
#> 
#> $release_date
#> [1] "2015-10-01T13:30:49Z"
#> 
#> $uri
#> [1] "http://api.zeit.de/content/3Ed7KYJOO2MXu5SQtnudQA"
#> 
#> $relations
#> $relations[[1]]
#> $relations[[1]]$uri
#> [1] "http://api.zeit.de/content/4mlIM3ZqG8bC0PZ0R8OwZy"
#> 
#> $relations[[1]]$rel
#> [1] "related"
#> 
#> $relations[[1]]$name
#> [1] "Das geteilte Land"
#> 
#> 
#> 
#> $supertitle
#> [1] "3. Oktober 1990"
#> 
#> $href
#> [1] "http://www.zeit.de/2015/40/3-10-1990-chronik-des-tages"
#> 
#> $teaser_text
#> [1] "Jeder weiß, dass sich am 3. Oktober 1990 Deutschland vereinigte. Aber was geschah an diesem Tag eigentlich genau? Eine Chronik verrückter Stunden"
#> 
#> $keywords
#> $keywords[[1]]
#> $keywords[[1]]$uri
#> [1] "http://api.zeit.de/keyword/wiedervereinigung"
#> 
#> $keywords[[1]]$rel
#> [1] "subject"
#> 
#> $keywords[[1]]$name
#> [1] "Wiedervereinigung"
#> 
#> 
#> $keywords[[2]]
#> $keywords[[2]]$uri
#> [1] "http://api.zeit.de/keyword/deutsche-wiedervereinigung"
#> 
#> $keywords[[2]]$rel
#> [1] "subject"
#> 
#> $keywords[[2]]$name
#> [1] "Deutsche Wiedervereinigung"
#> 
#> 
#> $keywords[[3]]
#> $keywords[[3]]$uri
#> [1] "http://api.zeit.de/keyword/helmut-kohl"
#> 
#> $keywords[[3]]$rel
#> [1] "person"
#> 
#> $keywords[[3]]$name
#> [1] "Helmut Kohl"
#> 
#> 
#> $keywords[[4]]
#> $keywords[[4]]$uri
#> [1] "http://api.zeit.de/keyword/bundesrepublik-deutschland"
#> 
#> $keywords[[4]]$rel
#> [1] "location"
#> 
#> $keywords[[4]]$name
#> [1] "Bundesrepublik Deutschland"
#> 
#> 
#> $keywords[[5]]
#> $keywords[[5]]$uri
#> [1] "http://api.zeit.de/keyword/ddr"
#> 
#> $keywords[[5]]$rel
#> [1] "subject"
#> 
#> $keywords[[5]]$name
#> [1] "DDR"
#> 
#> 
#> $keywords[[6]]
#> $keywords[[6]]$uri
#> [1] "http://api.zeit.de/keyword/nationalhymne"
#> 
#> $keywords[[6]]$rel
#> [1] "subject"
#> 
#> $keywords[[6]]$name
#> [1] "Nationalhymne"
#> 
#> 
#> 
#> $creators
#> $creators[[1]]
#> $creators[[1]]$uri
#> [1] "http://api.zeit.de/author/Martin-Machowecz"
#> 
#> $creators[[1]]$rel
#> [1] "author"
#> 
#> $creators[[1]]$name
#> [1] "Martin Machowecz"
#> 
#> 
#> $creators[[2]]
#> $creators[[2]]$uri
#> [1] "http://api.zeit.de/author/Stefan-Locke"
#> 
#> $creators[[2]]$rel
#> [1] "author"
#> 
#> $creators[[2]]$name
#> [1] "Stefan Locke"
#> 
#> 
#> 
#> $categories
#> $categories[[1]]
#> $categories[[1]]$uri
#> [1] "http://api.zeit.de/department/wissen"
#> 
#> $categories[[1]]$rel
#> [1] "department"
#> 
#> $categories[[1]]$name
#> [1] "Wissen"
#> 
#> 
#> $categories[[2]]
#> $categories[[2]]$uri
#> [1] "http://api.zeit.de/product/zei"
#> 
#> $categories[[2]]$rel
#> [1] "product"
#> 
#> $categories[[2]]$name
#> [1] "DIE ZEIT"
#> 
#> 
#> $categories[[3]]
#> $categories[[3]]$uri
#> [1] "http://api.zeit.de/department/geschichte"
#> 
#> $categories[[3]]$rel
#> [1] "sub_department"
#> 
#> $categories[[3]]$name
#> [1] "Geschichte"

To get a subset of the available output fields, set the fields parameter to one or a vector of fields.

zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA",
  fields=c("title", "release_date", "href"))
#> $release_date
#> [1] "2015-10-01T13:30:49Z"
#> 
#> $href
#> [1] "http://www.zeit.de/2015/40/3-10-1990-chronik-des-tages"
#> 
#> $title
#> [1] "Und Recht und Freibier"

To hide the result, set print to FALSE.

article.meta <- zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA", print=FALSE)

Example: Occurrences of German State Capitals in DIE ZEIT

Prepare the vectors of state capital names, latitude and longitude.

cap <- c("Berlin", "Bremen", "Dresden", "Düsseldorf", "Erfurt",
  "Hamburg", "Hannover", "Kiel", "Magdeburg", "Mainz", "München",
  "Potsdam", "Saarbrücken", "Schwerin", "Stuttgart", "Wiesbaden")
lat <- c(52.516667, 53.083333, 51.033333, 51.233333, 50.983333,
  53.565278, 52.366667, 54.333333, 52.133333, 50, 48.133333,
  52.4, 49.233333, 53.633333, 48.783333, 50.08) 
lon <- c(13.383333, 8.8, 13.733333, 6.783333, 11.033333,
  10.001389, 9.716667, 10.133333, 11.616667, 8.266667, 11.566667,
  13.066667, 7, 11.416667, 9.183333, 8.24)

Get data from DIE ZEIT. Search for ZEIT articles containing just “Berlin”.

berlin <- zeit_search("content", "Berlin", print=FALSE)

Get the number of articles found:

berlin$found
#> [1] 67068

And now the same for all state capitals.

found.l <- lapply(cap, function(x) zeit_search("content", x, print=FALSE)$found)
found <- unlist(found.l)

Normalize the numbers.

found.norm <- found/max(found)

Finally plot a bubble chart.

cols <- rainbow(16, alpha=.8)
symbols(lon, lat, circles=8*found.norm, fg=cols, lwd=2, 
    main="Occurrences of German State Capitals in DIE ZEIT",
  xlim=c(6, 16), ylim=c(46, 56), xlab="Longitude", ylab="Latitude", bty="n")
h <- c(1,2,3,4,6,7,8,11,15) # high occurrence capitals - just for readability
text(lon[h], lat[h], cap[h], col=cols[h])
text(lon[-c(h,16)], lat[-c(h,16)], cap[-c(h,16)], col=cols[-c(h,16)], pos=1)
text(lon[16], lat[16], cap[16], col=cols[16], pos=3)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.