#' List of inter-articles links on a wiki page
#'
#' @param x The id or title of the page to look at
#' @param domain The domain of the wiki where the page is located
#' @param namespace The namespace where the page need to be to be ept in the graph
#'
#' @return A character vector
#' @export
#'
#'
#' @family page functions
#'
#' @examples
#' page_links('Action') # listing all the links contained in the 'action' article.
page_links <- function(x, domain = "fr", namespace = "0") {
result <- vector(mode = "character")
query <- list(action = "query",
prop = "links",
plnamespace = namespace,
pllimit = "max",
redirects = "",
plcontinue = NULL)
pointer <- if(is.numeric(x)) "pageids" else "titles"
query[pointer] <- x
repeat {
exec <- exec_query(query, domain = domain)
dat <- exec$query$pages[[1]]$links %>%
sapply("[[", "title")
result <- c(result, dat)
query$plcontinue <- exec$continue$plcontinue
if (is.null(query$plcontinue)) {
break
}
}
result
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.