Wikipedia. Extracts external citation URLs from the References section of one or more Wikipedia article URLs. Use read_urls to scrape content from those URLs.

fetch_wiki_refs(url, n = NULL)

Arguments

url

Character vector of full Wikipedia article URLs (e.g. from fetch_wiki_urls).

n

Maximum number of citation URLs to return per source page. Default NULL returns all; use a number (e.g. 10) to limit.

Value

A data.table with columns source_url, ref_id, and ref_url, one row per citation across all input URLs. Use split(x, x$source_url) to group by article.

Examples

if (FALSE) { # \dontrun{
wiki_urls <- fetch_wiki_urls("January 6 Capitol attack")
refs_dt <- fetch_wiki_refs(wiki_urls)
articles <- read_urls(refs_dt$ref_url)
} # }