Title: | R Interface to the ZEIT ONLINE Content API |
---|---|
Description: | A wrapper for the ZEIT ONLINE Content API, available at <http://developer.zeit.de>. 'diezeit' gives access to articles and corresponding metadata from the ZEIT archive and from ZEIT ONLINE. A personal API key is required for usage. |
Authors: | Christian Graul |
Maintainer: | Christian Graul <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1-0 |
Built: | 2024-11-04 03:02:39 UTC |
Source: | https://github.com/chgrl/diezeit |
changes
brings up the NEWS file of the package.
changes(pkg = "diezeit")
changes(pkg = "diezeit")
pkg |
Set to the default "diezeit". Other packages make no sense. |
## Not run: changes() ## End(Not run)
## Not run: changes() ## End(Not run)
A 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 and from ZEIT ONLINE. A personal API key is required for usage.
Accessing the ZEIT archive requires an API key, that 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
zeit_client
for client information and usage,
zeit_search
for ZEIT archive search or zeit_get
to get content from the ZEIT archive.
zeit_client
does not provide content per se,
but lets you get information about your API usage.
zeit_client(print = TRUE)
zeit_client(print = TRUE)
print |
if |
a list of information about the client and API usage
## Not run: zeit_client() ## End(Not run)
## Not run: zeit_client() ## End(Not run)
zeit_get
will get you all available metadata for a specific item.
zeit_get(endpoint, id, fields, print = TRUE)
zeit_get(endpoint, id, fields, print = TRUE)
endpoint |
one of |
id |
item id. |
fields |
partially select output fields, as string value or vector of strings for multiple fields. |
print |
if |
Endpoints
The API is structured into several endpoints that provide specific functionalities:
author |
content by this author | |
content |
get content by ID | |
department |
content from this department | |
keyword |
content about this keyword | |
product |
content from this product | |
series |
content in this series |
List of metadata items.
http://developer.zeit.de/docs/
## Not run: # get article metadata by ID zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA") # partial selection of output fields zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA", fields=c("title", "release_date", "href")) # hide result article.meta <- zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA", print=FALSE) ## End(Not run)
## Not run: # get article metadata by ID zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA") # partial selection of output fields zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA", fields=c("title", "release_date", "href")) # hide result article.meta <- zeit_get("content", "3Ed7KYJOO2MXu5SQtnudQA", print=FALSE) ## End(Not run)
zeit_search
exposes a search for ZEIT archive items.
You can set search queries, paginate, sort and partially select the fields,
that should be returned. Articles, that match your query, are returned with
a reduced set of meta data.
zeit_search(endpoint, query, fields, limit = 10, offset = 0, sort, print = TRUE)
zeit_search(endpoint, query, fields, limit = 10, offset = 0, sort, print = TRUE)
endpoint |
one of |
query |
the main search query; single string value or vector of strings. |
fields |
partially select output fields, as string value or vector of strings for multiple fields. |
limit |
limit the amount of matches to return; set to |
offset |
offset for the list of matches; set to |
sort |
sort search results by any of the returned |
print |
if |
Endpoints
The API is structured into several endpoints that provide specific functionalities:
author |
search all authors | |
content |
search for content | |
department |
search all departments | |
keyword |
search all keywords | |
product |
search all products | |
series |
search all series |
Query syntax
You can search the entire article text and all meta data simply by setting the query parameter to your search phrase. The search uses entire strings "as is". To search for multiple tokens use a vector of strings.
All fields of an article can be queried individually by using [field]:[search string]
.
For example, to get articles that have the word "Kennedy" in their headline, you would
search for "title:Kennedy"
.
Currently all endpoint
s other than content
only support simple search phrases
with asterisk (*
) wildcards.
A list of matches to the query.
http://developer.zeit.de/docs/
## Not run: # simple content search zeit_search(endpoint="content", query="bayreuth") zeit_search("content", "bayreuth") # same same # multiple tokens zeit_search("content", c("bayreuth", "festspiele")) # entire string zeit_search("content", "bayreuther festspiele") # field query zeit_search("content", "title:bayreuth") # partial selection zeit_search("content", "bayreuth", fields=c("title", "teaser_text")) # pagination zeit_search("content", "bayreuth", limit=1) # just one match zeit_search("content", "bayreuth", limit=1, offset=1) # just the second match # sorting zeit_search("content", "bayreuth", sort=c("release_date", "asc")) # sort by date zeit_search("content", "bayreuth", sort=list(c("release_date", "desc"), c("title", "asc"))) # sort by date and title # hide matches bt.matches <- zeit_search("content", "bayreuth", print=FALSE) # author search zeit_search(endpoint="author", query="Stefan Locke") ## End(Not run)
## Not run: # simple content search zeit_search(endpoint="content", query="bayreuth") zeit_search("content", "bayreuth") # same same # multiple tokens zeit_search("content", c("bayreuth", "festspiele")) # entire string zeit_search("content", "bayreuther festspiele") # field query zeit_search("content", "title:bayreuth") # partial selection zeit_search("content", "bayreuth", fields=c("title", "teaser_text")) # pagination zeit_search("content", "bayreuth", limit=1) # just one match zeit_search("content", "bayreuth", limit=1, offset=1) # just the second match # sorting zeit_search("content", "bayreuth", sort=c("release_date", "asc")) # sort by date zeit_search("content", "bayreuth", sort=list(c("release_date", "desc"), c("title", "asc"))) # sort by date and title # hide matches bt.matches <- zeit_search("content", "bayreuth", print=FALSE) # author search zeit_search(endpoint="author", query="Stefan Locke") ## End(Not run)