Marc Kupietz | 898515a | 2023-05-10 15:21:38 +0200 | [diff] [blame] | 1 | library(RKorAPClient) |
| 2 | library(httr) |
| 3 | library(kableExtra) |
| 4 | library(dplyr) |
| 5 | |
| 6 | query = 'V\u00F6ner' # "Portable packages must use only ASCII characters in their demos. Use \uxxxx escapes for other characters." |
| 7 | |
| 8 | korap_app <-oauth_app("test-korap-client", key = "773NHGM76N7P9b6rLfmpM4", secret = NULL) |
| 9 | korap_endpoint <- oauth_endpoint(NULL, |
| 10 | "settings/oauth/authorize", |
| 11 | "api/v1.0/oauth2/token", |
| 12 | base_url = "https://korap.ids-mannheim.de") |
| 13 | token_bundle = oauth2.0_token(korap_endpoint, korap_app, scope = "search match_info", cache = FALSE) |
| 14 | |
| 15 | new("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() |