prague-blockchain-week/utils/syncTools.js

17 řádky
442 B
JavaScript
Surový Normální zobrazení Historie

2023-01-23 04:37:12 +01:00
import cheerio from "https://esm.sh/cheerio";
2023-01-23 03:37:00 +01:00
export async function loadJSONUrl(url) {
const resp = await fetch(url);
2023-01-23 04:37:12 +01:00
return resp.json();
}
export async function loadHtmlUrl(url) {
2023-01-24 02:44:48 +01:00
const resp = await fetch(url, {
headers: {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
},
});
2023-01-23 04:37:12 +01:00
return cheerio.load(await resp.text());
2023-01-23 03:37:00 +01:00
}