playwright / test_evaluate.mjs
and
w
495f8f5
// let res = await fetch('https://gowah44030-playwright.hf.space/evaluate', {
// method: "POST",
// body: JSON.stringify({
// url: 'https://chat.lmsys.org/assets/index-c347e3dc.js',
// code: `
// (async function(){
// return await new Promise(async (resolve)=>{
// try {
// //resolve(await fetch('https://chat.lmsys.org').then(res=>res.text()));
// } catch (e) { resolve(e);}
// //return;
// const ws = new WebSocket('wss://chat.lmsys.org/queue/join');
// ws.addEventListener('error', (e) => { resolve('error');});
// ws.addEventListener('open', function open() { resolve('open');});
// ws.addEventListener('close', () => { resolve('A') });
// //ws.on('message', function message(_data) { console.log(_data);});
// });
// })()
// `,
// })
// }).then(res=>res.text());
let res = await fetch('https://gowah44030-playwright.hf.space/evaluate', {
method: "POST",
body: JSON.stringify({
url: 'https://www.investing.com',
code: `
(async function(){
return await new Promise(async (resolve)=>{
try {
resolve(
await fetch('https://api.investing.com/api/financialdata/8849/historical/chart/?interval=PT1M&pointscount=60')
//await fetch('https://www.investing.com')
.then(res=>{
return res.text();
})
);
} catch (e) { resolve(e);}
});
})()
`,
})
}).then(res=>res.text());
console.log(res);