避免/绕过 Chrome 中的开发工具检测?

问题描述 投票:0回答:3

我一直在尝试从网站获取视频源,但是当我打开开发工具来执行此操作时,它向我显示以下消息:“不要打开开发人员工具”。

到目前为止我已经尝试过:

  • 关闭 javascript -> 不起作用,无法加载视频。

  • 找到函数:

olplayer.src({type:"application/x-mpegURL",src:"https://127.0.0.1/no_video.mp4.m3u8"});
document.body.innerHTML="";
document.write(" Dont open Developer Tools. ");
throw new Error(" Dont open Developer Tools. ");
self.location.replace('https:'+window.location.href.substring(window.location.protocol.length));

设置断点并重新加载,运行:

Object.defineProperty(window, "console", {configurable: false});

有什么想法可以绕过这种保护吗?

javascript google-chrome google-chrome-devtools devtools adblock
3个回答
5
投票

您可能正在谈论 hqq.tv 上托管的视频。他们的代码使用了一个

check()
函数,该函数可以执行所有令人讨厌的魔法来阻止所有黑客尝试,因此完全绕过保护的最简单方法是禁用此函数。

最近,Chrome 支持 JavaScript 代码的本地覆盖(我从 this SO thread 中发现了这一点)。关于其工作原理的更好解释可以在Medium上找到。

所以我继续找到

check()
函数(在我的例子中是
hqq.tv/js/embed.129.js
)并将其添加到 Overrides 中。在重写的版本中,我找到了
check()
函数,并将
return true;
添加到其开头:

function check(){return true; var element=new Image(); ...

但是,这只会禁用开发工具保护,但并不会让您在保存视频方面变得更轻松。 我自己的解决方案在hqq.tv上不起作用,我也没有运气使用videohelp论坛上建议的解决方案。但是,我能够使用 Stream Recorder Chrome 扩展程序捕获流。


0
投票

我找到了检测的绕过方法,对于 Chrome(或您喜欢的浏览器)使用

FireBug Lite extension
。它绕过检测,因为它是一个扩展


0
投票

所以你正在尝试从 hqq.tv 网站获取 m3u8 链接,也许我有东西给你

import axios from "axios";
const response = await axios.get(
  "https://hqq.tv/player/embed_player.php?vid=QkNSWnNReXIxVHNGbmhuWWRaR1E4dz09",  //example url
  {
    headers: {
      Referer: "https://tioanime.com/",
    },
  }
);
const regexPattern = /olplayer\.src\(\s*({[^]*?})\s*\);/g;
const regex = new RegExp(regexPattern);
const matches = response.data.matchAll(regex);
let finalResponse = "";
for (const match of matches) {
  const extractedContent = match[1].trim();
  if (extractedContent === "{ type: 'application/x-mpegURL', src:vurl}") {
    continue;
  }
  finalResponse += extractedContent;
}
const streamUrl = finalResponse
  .replace(/src/g, '"src"')
  .replace(/'https/g, '"https')
  .replace(/',/g, '",')
  .replace(/type/g, '"type"')
  .replace(/'application\/x-mpegURL'/g, '"application/x-mpegURL"');
console.log(JSON.parse(streamUrl));

此代码将为您提供最终的 m3u8 链接

© www.soinside.com 2019 - 2024. All rights reserved.