Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement native stealth mode #57

Open
DeployThemAll opened this issue Oct 9, 2023 · 5 comments
Open

Implement native stealth mode #57

DeployThemAll opened this issue Oct 9, 2023 · 5 comments

Comments

@DeployThemAll
Copy link

I'm trying to create a script to open few pages using puppeteer in stealth mode

I managed to add single-file extension while opening the browser page. but I can't send a request to the extension to start saving the current tab.

I'm doing this because I couldn't download some pages with cli without a stealth mode which I don't know to implement it in case of single-file.

I wish single-file has a native stealth mode implemented.

@gildas-lormeau
Copy link
Owner

Sorry for the late answer, I guess the simplest solution would be to merge the code of https://github.com/gildas-lormeau/single-file-cli in your project.

@DeployThemAll
Copy link
Author

No need to apologize, You are really doing a great job updating and managing this repo so far.

I'm trying to download it with Cli as well but I alway get hit with Network checking detection.

#54

You can try to download the url using the cli and see what I mean.

If Single file could integrate stealth plugin as an option while using puppeteer as a backend would be an amazing update.

I'm open for other solution as well.

@gildas-lormeau gildas-lormeau changed the title How to call Single-File extension from automated browser Implement native stealth mode Oct 17, 2023
@gildas-lormeau gildas-lormeau transferred this issue from gildas-lormeau/SingleFile Oct 17, 2023
@DeployThemAll
Copy link
Author

Hey, Are we expecting Native Stealth Mode soon?

@gildas-lormeau
Copy link
Owner

gildas-lormeau commented Mar 20, 2024

You can now pass easily the path to your user data folder with the switch --browser-arg, e.g.
./single-file https://www.example.com --browser-arg="--user-data-dir=/Users/<username>/Library/Application Support/Google/Chrome" (on macOS).

Is this feature sufficient to bypass CloudFlare and co?

@pirate
Copy link
Contributor

pirate commented Aug 30, 2024

I've had success using a Chrome Profile with logged in accounts, passed to single-file-cli using --browser-args=... to get around Cloudflare and other CAPTCHA-gated sites.

You can also install it as an extension in Chrome, connect manually to chrome with puppeteer + puppeteer-extra-plugin-stealth, then simulate clicking Singlefile extension icon to trigger it with all the stealth stuff applied:

const singlefile_ctx = ... // get the SingleFile service worker/background.js context

await singlefile_ctx.evaluate(async (tab) => {
	// Pass a specific tab, or fallback to currently focused foreground tab
    tab = tab || (await new Promise((resolve) => 
        chrome.tabs.query({currentWindow: true, active: true}, ([tab]) => resolve(tab))))
    
	// Simulate clicking Singlefile extension icon in menubar
    await chrome.action.onClicked.dispatch(tab);
    // Singlefile activates and saves its output to ~/Downloads/singlefile.html
    // https://developer.chrome.com/docs/extensions/reference/api/action#event-onClicked
}, tab);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants