blob: 47fccd1ab8f82df52aa0c027b3e7eed7201b017a [file] [log] [blame]
Marc Kupietz898515a2023-05-10 15:21:38 +02001library(RKorAPClient)
2library(httr)
3library(kableExtra)
4library(dplyr)
5
6query = 'V\u00F6ner' # "Portable packages must use only ASCII characters in their demos. Use \uxxxx escapes for other characters."
7
8korap_app <-oauth_app("test-korap-client", key = "773NHGM76N7P9b6rLfmpM4", secret = NULL)
9korap_endpoint <- oauth_endpoint(NULL,
10 "settings/oauth/authorize",
11 "api/v1.0/oauth2/token",
12 base_url = "https://korap.ids-mannheim.de")
13token_bundle = oauth2.0_token(korap_endpoint, korap_app, scope = "search match_info", cache = FALSE)
14
15new("KorAPConnection", verbose = TRUE, accessToken = token_bundle[["credentials"]][["access_token"]]) %>%
16 corpusQuery(query, fields = c("textSigle", "pubDate", "corpusTitle", "snippet"),
17 metadataOnly = FALSE) %>%
18 fetchAll() %>%
19 slot("collectedMatches") %>%
20 dplyr::arrange(pubDate) %>%
21 kable(escape = FALSE, caption = paste0("Query hits for '", query, "' ordered by date of publication")) %>%
22 kable_styling()