[GH-ISSUE #65] I just put the jsdelivr link to blocked links :3c #37

Open
opened 2026-03-01 14:34:02 +03:00 by kerem · 7 comments
Owner

Originally created by @dora-meowmeow on GitHub (Sep 2, 2023).
Original GitHub issue: https://github.com/AEPKILL/devtools-detector/issues/65

yeah no this is an evil script why would you do this

don't forget to put "https://cdn.jsdelivr.net/npm/devtools-detector" into ABP's blocked pages to disable this!

Originally created by @dora-meowmeow on GitHub (Sep 2, 2023). Original GitHub issue: https://github.com/AEPKILL/devtools-detector/issues/65 yeah no this is an evil script why would you do this don't forget to put "https://cdn.jsdelivr.net/npm/devtools-detector" into ABP's blocked pages to disable this!
Author
Owner

@insinfo commented on GitHub (Feb 24, 2024):

@catdotjs
Did you find any way to fool these damn devtoon detectors? I have a problem with puppeteer on a website
https://github.com/zfcsoftware/puppeteer-real-browser/issues/14

<!-- gh-comment-id:1962424505 --> @insinfo commented on GitHub (Feb 24, 2024): @catdotjs Did you find any way to fool these damn devtoon detectors? I have a problem with puppeteer on a website https://github.com/zfcsoftware/puppeteer-real-browser/issues/14
Author
Owner

@insinfo commented on GitHub (Feb 24, 2024):

I'm also facing this problem, but in my case it's this link https://brbeast.com/video/f79921bbae40a577928b76d2fc3edc2a, if I search using uBlock the url https://cdn.jsdelivr.net/npm/devtools-detector, the video player starts playing the video and leaves the page, returning the navigation history to the previous page

<!-- gh-comment-id:1962428344 --> @insinfo commented on GitHub (Feb 24, 2024): I'm also facing this problem, but in my case it's this link https://brbeast.com/video/f79921bbae40a577928b76d2fc3edc2a, if I search using uBlock the url https://cdn.jsdelivr.net/npm/devtools-detector, the video player starts playing the video and leaves the page, returning the navigation history to the previous page
Author
Owner

@dora-meowmeow commented on GitHub (Feb 24, 2024):

@insinfo best thing to do is to really block non-essential packages. There is probably more than one dev detector or it is using a different dev detector.

<!-- gh-comment-id:1962743253 --> @dora-meowmeow commented on GitHub (Feb 24, 2024): @insinfo best thing to do is to really block non-essential packages. There is probably more than one dev detector or it is using a different dev detector.
Author
Owner

@dora-meowmeow commented on GitHub (Feb 24, 2024):

Besides whats your goal with this? If you are trying to extract the m3u8 file. You can just install a network monitor program from apt or some other package manager.

<!-- gh-comment-id:1962743971 --> @dora-meowmeow commented on GitHub (Feb 24, 2024): Besides whats your goal with this? If you are trying to extract the m3u8 file. You can just install a network monitor program from apt or some other package manager.
Author
Owner

@insinfo commented on GitHub (Feb 25, 2024):

Yes, I would like to extract the video, but it seems that there is no M3U8 file, from what I saw it is in a strange format, I still don't know how I can capture the video because the video is coming in chunks from this URL
https://mrbeast17.com/cdn/down/disk2/8e011e9e2e455c20b9a94345d0bc7af6/Video/720p/720p_008.html

I managed to make it work in Dart like this:

import 'package:puppeteer/puppeteer.dart';

final blockUrls = [
  //'https://pl20623807.toprevenuegate.com/20/41/ad/2041ad026c42ce264b91586de1c33c6e.js',
  'https://cdn.jsdelivr.net/npm/devtools-detector',
  //'https://code.jquery.com/jquery-1.12.4.min.js',
  //'https://brbeast.com/player/assets/scripts.php?v=6'
];

void main() async {
  final url = 'https://brbeast.com/video/f79921bbae40a577928b76d2fc3edc2a';
  final browser = await puppeteer.launch(
    timeout: Duration(days: 4),
    headless: false,
    defaultViewport: DeviceViewport(width: 1280, height: 720),
  );
   // Set custom user agent
  final customUA =
      'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36';

 

  const script = '''
() => {

  window.onbeforeunload = function() { return "sorry, Your some work will be lost - really sorry."; };
  
  function isDevToolsScript() {
      var stack = new Error().stack;
      return stack.includes('devtool');
  }

  Date.prototype.originalGetTime = Date.prototype.getTime;
  Date.prototype.getTime = function () {
      if (!isDevToolsScript()) {
          return this.originalGetTime();
      }
      return 0;
  }

  const originalOnMessageSetter = Object.getOwnPropertyDescriptor(Worker.prototype, 'onmessage').set;
  Object.defineProperty(Worker.prototype, 'onmessage', {
      set: function (fn) {
          if (!isDevToolsScript()) {
              originalOnMessageSetter.call(this, fn);
              return;
          }
          newFn = (ev) => {
              ev.data.time = 0;
              fn(ev);
          }
          originalOnMessageSetter.call(this, newFn);
      }
  });
}''';
  var page = await browser.newPage();
  await page.evaluateOnNewDocument(script);
  await page.setUserAgent(customUA);

  // Setting page view  { 'width': 1280, 'height': 720 }
  // await page.setViewport(DeviceViewport(width: 1280, height: 720));
// await page.setExtraHTTPHeaders({
// 		'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
// 		'upgrade-insecure-requests': '1',
// 		'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
// 		'accept-encoding': 'gzip, deflate, br',
// 		'accept-language': 'en-US,en;q=0.9,en;q=0.8'
// 	});
  await page.setRequestInterception(true);
  page.onRequest.listen((req) async {
    if (blockUrls.contains(req.url)) {
      req.abort();
    } else {
      req.continueRequest();
    }

    print('url:  ${req.url} | ${req.response?.headers}');
  });
  page.goto(url);
  await Future.delayed(Duration(seconds : 4));
  await page.screenshot();
  // await myPage.pdf();
  // await page.evaluate<String>('() => document.title');

  // Gracefully close the browser's process
  //await browser.close();
}


<!-- gh-comment-id:1963069777 --> @insinfo commented on GitHub (Feb 25, 2024): Yes, I would like to extract the video, but it seems that there is no M3U8 file, from what I saw it is in a strange format, I still don't know how I can capture the video because the video is coming in chunks from this URL https://mrbeast17.com/cdn/down/disk2/8e011e9e2e455c20b9a94345d0bc7af6/Video/720p/720p_008.html I managed to make it work in Dart like this: ```dart import 'package:puppeteer/puppeteer.dart'; final blockUrls = [ //'https://pl20623807.toprevenuegate.com/20/41/ad/2041ad026c42ce264b91586de1c33c6e.js', 'https://cdn.jsdelivr.net/npm/devtools-detector', //'https://code.jquery.com/jquery-1.12.4.min.js', //'https://brbeast.com/player/assets/scripts.php?v=6' ]; void main() async { final url = 'https://brbeast.com/video/f79921bbae40a577928b76d2fc3edc2a'; final browser = await puppeteer.launch( timeout: Duration(days: 4), headless: false, defaultViewport: DeviceViewport(width: 1280, height: 720), ); // Set custom user agent final customUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36'; const script = ''' () => { window.onbeforeunload = function() { return "sorry, Your some work will be lost - really sorry."; }; function isDevToolsScript() { var stack = new Error().stack; return stack.includes('devtool'); } Date.prototype.originalGetTime = Date.prototype.getTime; Date.prototype.getTime = function () { if (!isDevToolsScript()) { return this.originalGetTime(); } return 0; } const originalOnMessageSetter = Object.getOwnPropertyDescriptor(Worker.prototype, 'onmessage').set; Object.defineProperty(Worker.prototype, 'onmessage', { set: function (fn) { if (!isDevToolsScript()) { originalOnMessageSetter.call(this, fn); return; } newFn = (ev) => { ev.data.time = 0; fn(ev); } originalOnMessageSetter.call(this, newFn); } }); }'''; var page = await browser.newPage(); await page.evaluateOnNewDocument(script); await page.setUserAgent(customUA); // Setting page view { 'width': 1280, 'height': 720 } // await page.setViewport(DeviceViewport(width: 1280, height: 720)); // await page.setExtraHTTPHeaders({ // 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', // 'upgrade-insecure-requests': '1', // 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8', // 'accept-encoding': 'gzip, deflate, br', // 'accept-language': 'en-US,en;q=0.9,en;q=0.8' // }); await page.setRequestInterception(true); page.onRequest.listen((req) async { if (blockUrls.contains(req.url)) { req.abort(); } else { req.continueRequest(); } print('url: ${req.url} | ${req.response?.headers}'); }); page.goto(url); await Future.delayed(Duration(seconds : 4)); await page.screenshot(); // await myPage.pdf(); // await page.evaluate<String>('() => document.title'); // Gracefully close the browser's process //await browser.close(); } ```
Author
Owner

@Mqxx commented on GitHub (Mar 7, 2024):

@insinfo
You can do the following steps to avoid a devtool detector without breaking the page:

  1. Open the DevTools
  2. Go to Network panel and search for devtools-detector.js or something like this
  3. Right-Click that file and click on "Block request URL"
  4. Reload the page, you should get an error in the console that says:
    image
  5. Click on the link, this should take you to the Sources panel
  6. Set a breakpoint at that error line
    image
  7. Reload the page, the debugger should stop at that line
  8. Go to the Console panel and enter the following line this basically sets all functions to blank ones:
    devtoolsDetector={addListener: ()=>{},launch:()=>{},versionMap:{}}
  9. Go back to the Sources panel and resume the debugger

This successfully skips the devtools detector and does not break the page.
image

<!-- gh-comment-id:1982870203 --> @Mqxx commented on GitHub (Mar 7, 2024): @insinfo You can do the following steps to avoid a devtool detector without breaking the page: 1. Open the DevTools 2. Go to Network panel and search for `devtools-detector.js` or something like this 3. Right-Click that file and click on "Block request URL" 4. Reload the page, you should get an error in the console that says: ![image](https://github.com/AEPKILL/devtools-detector/assets/62719703/d035c2fd-a3d6-4352-b282-43b3ba23e876) 5. Click on the link, this should take you to the Sources panel 6. Set a breakpoint at that error line ![image](https://github.com/AEPKILL/devtools-detector/assets/62719703/d40618af-e698-4ed6-b023-320b2f404745) 7. Reload the page, the debugger should stop at that line 8. Go to the Console panel and enter the following line this basically sets all functions to blank ones: `devtoolsDetector={addListener: ()=>{},launch:()=>{},versionMap:{}}` 9. Go back to the Sources panel and resume the debugger This successfully skips the devtools detector and does not break the page. ![image](https://github.com/AEPKILL/devtools-detector/assets/62719703/06abb23e-8949-4bc3-b2be-f40507c91824)
Author
Owner

@Mqxx commented on GitHub (Apr 29, 2024):

You can do the following steps to avoid a devtool detector without breaking the page:

Or just use A tool like this: https://github.com/Andrews54757/Anti-Anti-Debug

<!-- gh-comment-id:2081975256 --> @Mqxx commented on GitHub (Apr 29, 2024): > You can do the following steps to avoid a devtool detector without breaking the page: Or just use A tool like this: https://github.com/Andrews54757/Anti-Anti-Debug
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/devtools-detector#37
No description provided.