rnbguy
rnbguy
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
ah. I was getting errors because I was using "domcontentloaded". all good in that case 🙂
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
also, I was using .$$eval before - which is not available in astral. but I worked it around by just using .evaluate. so it's not a biggie 🙂
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
@lino-levan awesome! with your latest commit, I managed to completely move from puppeteer to astral 🍻 only thing I missed is waitUntil in Page.goto() ref. https://github.com/puppeteer/puppeteer/blob/2fee2b0adc7fd5f26c7b1d75a3efa29c2fe12dab/packages/puppeteer-core/src/common/Frame.ts#L109
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
like, this can have another field called browserArgs?: string[].
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
I meant, passing argument to browser executable in general. I am fine with passing proxy-server argument by myself.
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
btw, I will try with HTTP_PROXY, but can you please add support for argument passing for browser executable? like for chrome, I can just pass --proxy-server=${proxyUrl}. no pressure 🙂
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
ooh awesome! @lino-levan if you're the maintainer, let me look into it more and open issues 🙂
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
but astral is not customizable enough like puppeteer 😦 I need to start the browser with proxy and send page.evaluate() with function arguments. but nonetheless, it looks solid. maybe I will come back to it later 🙂
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
hey @lino-levan thanks for suggesting astral. looks like it is fortified by default. 🙂 https://bot.sannysoft.com tests are passed
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
@jeff.hykin I can confirm import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts"; solves the issue. 🙂 but I need to use puppeteer-extra for fortification. 😦
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
I am actually using puppeteer-extra for fortified browser. the same behavior persists.
import "npm:puppeteer";
import { default as puppeteer } from "npm:puppeteer-extra";
import StealthPlugin from "npm:puppeteer-extra-plugin-stealth";
puppeteer.use(StealthPlugin());

const browser = await puppeteer.launch({
executablePath: "google-chrome-stable",
headless: "new",
});

const page = await browser.newPage();

try {
await page.goto("https://www.google.com");
} finally {
page.close();
browser.close();
}

console.log("bye")
import "npm:puppeteer";
import { default as puppeteer } from "npm:puppeteer-extra";
import StealthPlugin from "npm:puppeteer-extra-plugin-stealth";
puppeteer.use(StealthPlugin());

const browser = await puppeteer.launch({
executablePath: "google-chrome-stable",
headless: "new",
});

const page = await browser.newPage();

try {
await page.goto("https://www.google.com");
} finally {
page.close();
browser.close();
}

console.log("bye")
28 replies
DDeno
Created by rnbguy on 8/22/2023 in #help
puppeteer makes script to hang for a while at the end
@lino-levan here is a code reproducing the behavior on my machine.
import puppeteer from "npm:puppeteer";

const browser = await puppeteer.launch({
executablePath: "google-chrome-stable",
headless: "new",
});

const page = await browser.newPage();

try {
await page.goto("https://www.google.com");
} finally {
page.close();
browser.close();
}

console.log("bye")
import puppeteer from "npm:puppeteer";

const browser = await puppeteer.launch({
executablePath: "google-chrome-stable",
headless: "new",
});

const page = await browser.newPage();

try {
await page.goto("https://www.google.com");
} finally {
page.close();
browser.close();
}

console.log("bye")
28 replies
DDeno
Created by rnbguy on 3/13/2023 in #help
Islands not working with Cloudflare DNS proxy
I have a feeling, this might be because of Cloudflare caching. but don't really know how to go on about it.
3 replies
DDeno
Created by rnbguy on 3/13/2023 in #help
Islands not working with Cloudflare DNS proxy
Here are links to my website, https://tla.rnbguy.at - with Cloudflare proxy with Full TLS/SSL https://6ts57v4cvdd79cs4m5d3e3nv0o.ingress.dcnorse.ddns.net - self-signed cert without Cloudflare proxy
3 replies
DDeno
Created by rnbguy on 3/6/2023 in #help
window variable in fresh islands
I came this far,
export default function Run() {
const editorRef = useRef(null);
const consoleText = signal("Click run to run..");
const revText = computed(() =>
consoleText.value.split("").reverse().join("")
);

let editor = null;

useEffect(() => {
if (IS_BROWSER) {
require.config({
paths: { vs: "https://unpkg.com/monaco-editor/min/vs" },
});

if (monaco !== undefined) {
editor = monaco.editor.create(editorRef.current, {
value: ["function x() {", '\tconsole.log("Hello world!");', "}"].join(
"\n",
),
language: "javascript",
});
}
}
});

return (
<div class="gap-2 w-full">
<div
ref={editorRef}
class="rounded min-w-full min-h-[30rem] overflow-x-auto bg-gray-100"
/>

<Button
class="mx-auto items-center"
onClick={() => {consoleText.value = editor.getValue()}}
>
Run
</Button>

<div class="rounded min-w-full min-h-[30rem] overflow-x-auto bg-gray-100">
{revText}
</div>

<link
rel="stylesheet"
data-name="vs/editor/editor.main"
href="https://unpkg.com/monaco-editor/min/vs/editor/editor.main.css"
/>

<script src="https://unpkg.com/monaco-editor/min/vs/loader.js" />
<script src="https://unpkg.com/monaco-editor/min/vs/editor/editor.main.nls.js" />
<script src="https://unpkg.com/monaco-editor/min/vs/editor/editor.main.js" />
</div>
);
}
export default function Run() {
const editorRef = useRef(null);
const consoleText = signal("Click run to run..");
const revText = computed(() =>
consoleText.value.split("").reverse().join("")
);

let editor = null;

useEffect(() => {
if (IS_BROWSER) {
require.config({
paths: { vs: "https://unpkg.com/monaco-editor/min/vs" },
});

if (monaco !== undefined) {
editor = monaco.editor.create(editorRef.current, {
value: ["function x() {", '\tconsole.log("Hello world!");', "}"].join(
"\n",
),
language: "javascript",
});
}
}
});

return (
<div class="gap-2 w-full">
<div
ref={editorRef}
class="rounded min-w-full min-h-[30rem] overflow-x-auto bg-gray-100"
/>

<Button
class="mx-auto items-center"
onClick={() => {consoleText.value = editor.getValue()}}
>
Run
</Button>

<div class="rounded min-w-full min-h-[30rem] overflow-x-auto bg-gray-100">
{revText}
</div>

<link
rel="stylesheet"
data-name="vs/editor/editor.main"
href="https://unpkg.com/monaco-editor/min/vs/editor/editor.main.css"
/>

<script src="https://unpkg.com/monaco-editor/min/vs/loader.js" />
<script src="https://unpkg.com/monaco-editor/min/vs/editor/editor.main.nls.js" />
<script src="https://unpkg.com/monaco-editor/min/vs/editor/editor.main.js" />
</div>
);
}
This works fine. but I would prefer not to use the <script/> and <link/> tags. How do I do this cleanly in fresh?
6 replies
DDeno
Created by rnbguy on 3/6/2023 in #help
window variable in fresh islands
wow. this really helped. but I am stuck at similar other things. basically, I am trying to port this code in fresh. how do I import the <script/> tags? https://github.com/microsoft/monaco-editor/blob/main/samples/browser-script-editor/index.html
6 replies