#' Execute a query to the MediaWiki API
#'
#' @param query A list giving query information
#' @param domain The domain where the wiki is located.
#'
#' @importFrom httr content GET
#' @importFrom magrittr %>%
#'
#' @export
exec_query <- function(query, domain = "fr") {
query["format"] <- "json"
tryCatch({paste("https://", domain, ".wikipedia.org/w/api.php", sep = "") %>%
GET(query = query) %>%
content("parsed")}, error = function(e) NULL)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.