helloworld / deploy /scripts /probe_tiles.js
eduzrh's picture
Upload deploy/scripts/probe_tiles.js with huggingface_hub
32424cd verified
Raw History Blame Contribute Delete
976 Bytes
const { chromium } = require('playwright-core');
(async () => {
const b = await chromium.launch({
executablePath: '/data/tools/chrome-headless-shell-linux64/chrome-headless-shell',
args: ['--no-sandbox','--disable-dev-shm-usage','--use-gl=swiftshader','--enable-unsafe-swiftshader'],
});
const ctx = await b.newContext({ viewport:{width:1400,height:900}, locale:'zh-CN' });
const page = await ctx.newPage();
const urls = new Map();
page.on('requestfailed', r => { const u=r.url(); if(!urls.has(u)) urls.set(u,'FAIL '+ (r.failure()||{}).errorText); });
page.on('response', r => { const u=r.url(); if(/tile|\.png|\.pbf|carto|mapbox|arcgis|osm/.test(u) && !urls.has(u)) urls.set(u, r.status()); });
await page.goto('http://127.0.0.1/wm/', {waitUntil:'domcontentloaded',timeout:60000});
await page.waitForTimeout(25000);
const rows = [...urls.entries()].slice(0,25);
for (const [u,s] of rows) console.log(s, u.slice(0,110));
await b.close();
})();