This repository has been archived on 2022-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
tghandbook/lib/wiki.ts

12 lines
437 B
TypeScript
Raw Normal View History

2020-06-16 09:32:48 +00:00
const WIKI_BASE = "https://cors-anywhere.herokuapp.com/tgstation13.org/wiki";
/**
* 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["*"];
}