DNA
DNA
DDeno
Created by SabaMazmishvili on 5/3/2024 in #help
I cant install deno by running this command: curl -fsSL https://deno.land/install.sh | sh
No description
12 replies
DDeno
Created by SabaMazmishvili on 5/3/2024 in #help
I cant install deno by running this command: curl -fsSL https://deno.land/install.sh | sh
Your problem is not deno itself. It's your code. The error explains it pretty well:
Listening on http://localhost:8000/
http://localhost:3000/
error: Uncaught (in promise) TypeError: server is not async iterable
for await (const req of server) {
^
at file:///E:/img-view/saba.ts:7:25
Listening on http://localhost:8000/
http://localhost:3000/
error: Uncaught (in promise) TypeError: server is not async iterable
for await (const req of server) {
^
at file:///E:/img-view/saba.ts:7:25
Generally, I would use Deno.serve instead of the function you use, because it's deprecated (see screenshot below). Then, your code would look like this:
Deno.serve({port: 3000}, (req: Request) => {
if (req.url === "/") return new Response(Deno.readTextFileSync("./public/index.html"), {status: 200});
else return new Response("Not Found", {status: 404});
});
Deno.serve({port: 3000}, (req: Request) => {
if (req.url === "/") return new Response(Deno.readTextFileSync("./public/index.html"), {status: 200});
else return new Response("Not Found", {status: 404});
});
12 replies
DDeno
Created by DNA on 4/8/2024 in #help
Capturing network requests using Puppeteer?
Also, if that matters, the master.m3u8 is requested from inside an iframe
4 replies
DDeno
Created by Skylark on 3/29/2024 in #help
update deno version on Alpine
Have you tried deno upgrade in your terminal? This directly downloads the files from their github page
8 replies
DDeno
Created by DNA on 3/24/2024 in #help
Kill Deno.Command
Thank you very much
10 replies
DDeno
Created by DNA on 3/24/2024 in #help
Kill Deno.Command
That works
10 replies
DDeno
Created by DNA on 3/24/2024 in #help
Kill Deno.Command
How can i wait for that command to finish though?
10 replies
DDeno
Created by DNA on 3/24/2024 in #help
Kill Deno.Command
That works, thanks
10 replies
DDeno
Created by DNA on 3/24/2024 in #help
Kill Deno.Command
Not an option
10 replies
DDeno
Created by DNA on 3/24/2024 in #help
Kill Deno.Command
No description
10 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
Is it possible to manually set the useragent?
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
So i just ran into the next problem. When intercepting the requests, on windows, the request for master.m3u8 comes in and is also console.logged, but on my linux machine, the request never shows up. Does anyone have an idea, why it is like that? Also, the screenshot taken right before the while loop looks just the same on both machines Code:
const videoPage = await browser.newPage();
await videoPage.setViewportSize({width: 1920, height: 1080});
console.log("Video page prepared");

const videoPageCelestial = videoPage.unsafelyGetCelestialBindings();
await new Promise<void>((resolve) => (videoPageCelestial.ws.readyState === 1 ? resolve() : (videoPageCelestial.ws.onopen = () => resolve())));
await videoPageCelestial.Fetch.enable({});

console.log("Enabled request interception");

videoPageCelestial.addEventListener("Fetch.requestPaused", (event) => {
console.log("\n" + event.detail.request.url);
if (event.detail.request.url.includes("master.m3u8")) data.master = event.detail.request.url;

if (event.detail.request.url.includes(".png") || event.detail.request.url.includes(".jpeg") || event.detail.request.url.includes(".jpg") || event.detail.request.url.includes(".css") || event.detail.request.url.includes(".ico") || event.detail.request.url.includes(".gif") || event.detail.request.url.includes("data:image") || event.detail.request.url.includes("data:font")) return videoPageCelestial.Fetch.failRequest({requestId: event.detail.requestId, errorReason: "Aborted"});
else videoPageCelestial.Fetch.continueRequest({requestId: event.detail.requestId});
});

console.log("Going to video page: " + video);
await videoPage.goto(video);
console.log("Video page loaded, waiting for master.m3u8");

Deno.writeFileSync("screenshot.png", await videoPage.screenshot({format: "png"}));

while (!data.master) null; // <-- Stuck here on ubuntu server 23.10, proceeds after a few seconds on my main machine (windows 11) though
const videoPage = await browser.newPage();
await videoPage.setViewportSize({width: 1920, height: 1080});
console.log("Video page prepared");

const videoPageCelestial = videoPage.unsafelyGetCelestialBindings();
await new Promise<void>((resolve) => (videoPageCelestial.ws.readyState === 1 ? resolve() : (videoPageCelestial.ws.onopen = () => resolve())));
await videoPageCelestial.Fetch.enable({});

console.log("Enabled request interception");

videoPageCelestial.addEventListener("Fetch.requestPaused", (event) => {
console.log("\n" + event.detail.request.url);
if (event.detail.request.url.includes("master.m3u8")) data.master = event.detail.request.url;

if (event.detail.request.url.includes(".png") || event.detail.request.url.includes(".jpeg") || event.detail.request.url.includes(".jpg") || event.detail.request.url.includes(".css") || event.detail.request.url.includes(".ico") || event.detail.request.url.includes(".gif") || event.detail.request.url.includes("data:image") || event.detail.request.url.includes("data:font")) return videoPageCelestial.Fetch.failRequest({requestId: event.detail.requestId, errorReason: "Aborted"});
else videoPageCelestial.Fetch.continueRequest({requestId: event.detail.requestId});
});

console.log("Going to video page: " + video);
await videoPage.goto(video);
console.log("Video page loaded, waiting for master.m3u8");

Deno.writeFileSync("screenshot.png", await videoPage.screenshot({format: "png"}));

while (!data.master) null; // <-- Stuck here on ubuntu server 23.10, proceeds after a few seconds on my main machine (windows 11) though
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
Thanks once again, this worked
celestial.addEventListener("Fetch.requestPaused", async (event) => {
console.log(event.detail.request.url);
celestial.Fetch.continueRequest({requestId: event.detail.requestId});
});
celestial.addEventListener("Fetch.requestPaused", async (event) => {
console.log(event.detail.request.url);
celestial.Fetch.continueRequest({requestId: event.detail.requestId});
});
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
I still got a small question? How do i pass the request?
celestial.addEventListener("Fetch.requestPaused", async (event) => {
console.log(event);
});
celestial.addEventListener("Fetch.requestPaused", async (event) => {
console.log(event);
});
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
Thank you so much for helping me with my problems
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
Yeah that worked
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
ws.onopen is never called
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
But wouldnt the promise get resolved anyway, even if the request isnt handled yet? Im not getting "deno 1", which is right after the promise
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
I did implement this a bit differently than you did, but the result should be the same anyway. However, for some reason, its stuck after "done 0", basically at the Promise Code:
const celestial = videoPage.unsafelyGetCelestialBindings();
console.log("done 0");
await new Promise<void>((resolve) => (celestial.ws.onopen = () => resolve()));
console.log("done 1");
await celestial.Fetch.enable({});
console.log("done 2");

celestial.addEventListener("Fetch.requestPaused", async (event) => {
console.log(event);
});

console.log("done 3");
await videoPage.goto(video);
console.log("done 4");
const celestial = videoPage.unsafelyGetCelestialBindings();
console.log("done 0");
await new Promise<void>((resolve) => (celestial.ws.onopen = () => resolve()));
console.log("done 1");
await celestial.Fetch.enable({});
console.log("done 2");

celestial.addEventListener("Fetch.requestPaused", async (event) => {
console.log(event);
});

console.log("done 3");
await videoPage.goto(video);
console.log("done 4");
65 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
I cant use await on page.unsafelyGetCelestialBindings() however
65 replies