2020-06-17 13:16:54 +00:00
|
|
|
const WIKI_BASE = "https://tgproxy.ovo.ovh/wiki";
|
2020-06-16 09:32:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get HTML content of a page using Mediawiki Parse APIs
|
|
|
|
* @param name Page name
|
|
|
|
*/
|
|
|
|
export async function getPageHTML(name: string): Promise<string> {
|
|
|
|
const urlname = encodeURIComponent(name);
|
|
|
|
const apiURL = `/api.php?action=parse&page=${urlname}&prop=text&format=json`;
|
|
|
|
return (await (await fetch(WIKI_BASE + apiURL)).json()).parse.text["*"];
|
|
|
|
}
|
2020-06-17 13:16:54 +00:00
|
|
|
|
|
|
|
export default { getPageHTML };
|