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

fix infinite 503 problem cloudflare page #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions example/cloudflare.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'dart:io';
import 'package:puppeteer/plugins/stealth.dart';
import 'package:puppeteer/puppeteer.dart';

void main() async {
puppeteer.plugins.add(StealthPlugin());

var browser = await puppeteer.launch(headless: false, userDataDir: "./userdata/");
var page = await browser.newPage();

await page.goto('https://bot.sannysoft.com/');
page = await browser.newPage();
await page.goto('https://voiranime.com/');
await Future.delayed(Duration(seconds: 500));

await browser.close();
}
5 changes: 4 additions & 1 deletion lib/src/plugins/stealth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class StealthPlugin extends Plugin {
_navigatorLanguages,
_navigatorPermission,
_navigatorPlugin,
_navigatorWebdriver,
// _navigatorWebdriver,
_webglVendor,
_windowOuterDimensions,
]) {
Expand All @@ -36,6 +36,9 @@ class StealthPlugin extends Plugin {
// Have viewport match window size, unless specified by user
if (options.defaultViewport == LaunchOptions.viewportNotSpecified) {
options = options.replace(defaultViewport: null);


options.args.add('--disable-blink-features=AutomationControlled');
}

return options;
Expand Down
Loading