关注它,不迷路。
本文章中所有内容仅供学习交流,不可用于任何商业用途和非法用途,否则后果自负,如有侵权,请联系作者立即删除!
最近美食群发了很多二维码,提取链接后,可以在移动端的浏览器上愉快的播放,然而,当我把 url 链接复制到 我电脑上的 浏览器再访问时,出现了这个:

访问不了,没关系,抓包,发现请求了一个js:

js内容是这样的:
- function randomString(length, chars) {
- var result = '';
- for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
- return result;
- }
- function myEeplace(s) {
- return s.replace(/\{(\w+?)\}/g, function (a, b) {
- var h = '';
- for (var i = 0; i < b.length; i++) {
- if ('n' == b[i]) {
- h += Math.floor(Math.random() * 10);
- } else if ('w' == b[i]) {
- h += String.fromCharCode(97 + Math.floor(Math.random() * 26));
- }
- }
- return h;
- });
- }
- if (/(MicroMessenger)/i.test(navigator.userAgent)) {
- var rString = randomString(3307, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
- var urls = [
- 'http://****',
- ];
- location.href = myEeplace(urls[Math.floor(Math.random() * urls.length)]) + "&" + window.location.search.replace("?", "");
- } else {
-
- var rString = randomString(3107, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
- var urls = [
- 'http://***',
- ];
- location.href = myEeplace(urls[Math.floor(Math.random() * urls.length)]) + "&" + window.location.search.replace("?", "");
-
- }
- if ((/^(Win|Mac)/i.test(navigator.platform) || !/mobile|Android|phone|iPhone|iPod|ios|iPad/i.test(navigator.userAgent)) && (!localStorage.isCheney || parseInt(conf.mobile))) {
- location = 'a27aa89cef2cd192b8f3c9b0b97e670d.png';
- }
看到这么多 location = , 瞬间明白为啥访问不了了,因此,将最后一个if语句删除,替换后再访问:

还是报错,但是看抓包,有新的请求:

浏览器上看不到响应,可以使用 Reqable 来抓包:

点击如图所示的下载按钮,将网页下载下来,发现有一段js代码:

把代码复制下来,还原后,核心代码就这么点:
- function aaa1() {
- if ((/^(Win|Mac)/i['test'](navigator["platform"]) || !/mobile|Android|phone|iPhone|iPod|ios|iPad/i["test"](navigator["userAgent"])) && (!localStorage['isCheney'] || parseInt(conf["mobile"]))) {
- location = 'a27aa89cef2cd192b8f3c9b0b97e670d.png';
- }
- }
- aaa1();
又是一个检测移动端环境,然后跳转赋值,使用 Reqable 将 aaa1(); 给替换掉:

再次请求后,不报错了,页面正常了,nice!
今天的文章就分享到这里,后续分享更多的技巧,敬请期待。

欢迎加入知识星球,学习更多AST和爬虫技巧。