const fetch = require("node-fetch");
const headers =
{
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.9",
"cache-control": "max-age=0",
//if-modified-since: Sun, 16 Feb 2020 21:24:32 GMT
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36",
};
const URL = "https://fonts.googleapis.com/css?family=Roboto&display=swap";
let text = "";
let i = 0;
while (text.indexOf("/normal") <= -1)
{
text = await (await fetch(URL, { headers })).text();
//console.log(text);
if (i++ % 100 === 0)
console.log(text.indexOf("/normal"));
}
text