#' Getting the ID of a list of pages
#'
#' @param pages A character vector of pages title.
#' @param domain The domain where the wiki is located
#'
#' @importFrom plyr llply
#' @import magrittr
#'
#' @return A data-frame with id, namespace and title column
#' @export
#'
page_id <- function(pages, domain = "fr") {
id <- divide_list(pages) %>%
llply(function(x) {
query <- list(
action = "query",
format = "json",
indexpageids = "1",
titles = x,
redirect = ""
)
dat <- exec_query(query)
if(!is.null(dat)) {
dat$query$pageids %>% as.numeric()
} else {
warning("Network problem - results may be incomplete")
}
}, .progress = "text") %>% unlist
data.frame(pages, id)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.