ShilongLee / Crawler

抖音(a_bogus最新版)、快手、哔哩哔哩、小红书、淘宝、京东、微博平台帖子、评论、搜索、用户作品高性能爬虫服务器。docker一键快速部署。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

大佬,抖店的好像版本不一样。

cyqdev opened this issue · comments

bdms版本: https://lf-c-flwb.bytetos.com/obj/rc-client-security/web/stable/1.0.1.6-alpha.08/bdms.js

补环境半天,执行结果是个死循环,不知道哪里出问题。希望指点一下

image

是不是_u是导出的函数呢,看不到你的上下文,你可以参考一下我之前的补环境代码。

image
image
douyin.js

require('./env.js')
require('./source.js')


// console.log(window.qg)
function get_a_bogus(arguments){
    var a = window.qg._v
    return window.qg._u(a[0], arguments, a[0], a[2], null)

}
var arguments = [
    0,
    1,
    0,
    'coupon_type_group=0&favoured_type=0&status=0&page=1&size=10&sort_by_stock=false&_bid=ecom_market_shop&appid=1&_=1721019033316&msToken=ol9jD-cuRbTf6HV8VWup7QO1Sd_4tnAEWsGWVCxy0cWJH4mlsC-zG2xdOc9DZKqSlhoMG_TAbO0NDIPhu_C_fhm1Q33rETba7cz0bBEPm3PeB4cq6KmcgW8V_qkcOzir6wRjN8NSoImK3l_QwWwJPXrhGjBv8l2anHRc&msToken=ol9jD-cuRbTf6HV8VWup7QO1Sd_4tnAEWsGWVCxy0cWJH4mlsC-zG2xdOc9DZKqSlhoMG_TAbO0NDIPhu_C_fhm1Q33rETba7cz0bBEPm3PeB4cq6KmcgW8V_qkcOzir6wRjN8NSoImK3l_QwWwJPXrhGjBv8l2anHRc',
    '',
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWeb…KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
]
console.log(get_a_bogus(arguments))

env.js

// 环境
window = global
window.screen = {}
history = {}
document = {}
location = {
    "host": 'https://fxg.jinritemai.com'
}
navigator = {
    "webdriver": false,
    "vendorSub": '',
    'productSub': '20030107',
    'vendor': 'Google Inc.',
    'maxTouchPoints': 0,
    'scheduling': {},
    'userActivation': {'hasBeenActive': true, 'isActive': false},
    'doNotTrack': '1',
    'geolocation': {},
    'connection': {'downlink': 2.6, 'effectiveType': '4g', 'rtt': 50, 'saveData': false},
    'plugins': {
        "0": {
            "0": {}
        },
        "1": {
            "0": {}
        }
    },
    'mimeTypes': {
        "0": {},
        "1": {}
    },
    "pdfViewerEnabled": true,
    'webkitTemporaryStorage': {},
    'webkitPersistentStorage': {},
    'hardwareConcurrency': 8,   // 线程数
    'cookieEnabled': true,
    'appCodeName': 'Mozilla',
    'appVersion': '5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
    'platform': 'MacIntel',
    'product': 'Gecko',
    'language': 'zh-CN',
    'languages': [
        "zh-CN",
        "zh",
        "en"
    ],
    'onLine': true,
    'getGamepads': function () {

        return 'getGamepads() { [native code] }'
    },
    'javaEnabled': function () {

        return 'javaEnabled() { [native code] }'
    },
    'sendBeacon': function () {

        return 'sendBeacon() { [native code] }'
    },
    'vibrate': function () {

        return 'vibrate() { [native code] }'
    },
    'bluetooth': {},
    'clipboard': {},
    'credentials': {},
    'keyboard': {},
    'managed': {},
    'mediaDevices': {},
    'storage': {},
    'serviceWorker': {},
    'virtualKeyboard': {},
    'wakeLock': {},
    'deviceMemory': 8, // 内存
    'ink': {},
    'hid': {},
    'locks': {},
    'mediaCapabilities': {},
    'mediaSession': {},
    'permissions': {},
    'presentation': {},
    'serial': {},
    'gpu': {},
    'usb': {},
    'windowControlsOverlay': {},
    'xr': {},
    'clearAppBadge': function () {

        return 'clearAppBadge() { [native code] }'
    },
    'getBattery': function () {

        return 'getBattery() { [native code] }'
    },
    'getUserMedia': function () {

        return 'getUserMedia() { [native code] }'
    },
    'requestMIDIAccess': function () {

        return 'requestMIDIAccess() { [native code] }'
    },
    'requestMediaKeySystemAccess': function () {

        return 'requestMediaKeySystemAccess() { [native code] }'
    },
    'setAppBadge': function () {

        return 'setAppBadge() { [native code] }'
    },
    'webkitGetUserMedia': function () {

        return 'webkitGetUserMedia() { [native code] }'
    },
    'getInstalledRelatedApps': function () {

        return 'getInstalledRelatedApps() { [native code] }'
    },
    'registerProtocolHandler': function () {

        return 'registerProtocolHandler() { [native code] }'
    },
    'unregisterProtocolHandler': function () {

        return 'unregisterProtocolHandler() { [native code] }'
    },
    'appName': 'Netscape'
}
window.external = {}


window.CanvasRenderingContext2D = function () {

    return "CanvasRenderingContext2D() { [native code] }"
}

window.HTMLCanvasElement = function () {

    return "HTMLCanvasElement() { [native code] }"
}

window.RegExp = function RegExp() {

};

window.RegExp.prototype.test = function test() {
    return false
}

window.devicePixelRatio = 2
window.openDatabase = undefined
window.AudioContext = function () {

    return "AudioContext() { [native code] }"
}
window.webkitAudioContext = undefined
window.EventSource = function e(){
    return "EventSource() { [native code] }"
}
window._sdkGlueVersionMap = {
    "sdkGlueVersion": "1.0.0.51-alpha.07",
    "bdmsVersion": "1.0.1.6-alpha.08",
    "captchaVersion": "4.0.2"
}
document.createElement = function createElement(name) {
    return '<span></span>'
}

XMLHttpRequest = function () {
    return 'XMLHttpRequest() { [native code] }'
}
document.documentElement = {}
document.documentElement.style = {};
document.body = {}
document.body.appendChild = function (child) {
    if (this === child) {
        throw new dom.window.DOMException("Failed to execute 'appendChild' on 'Node': The new child element contains the parent.", "HierarchyRequestError");
    }
    return {};
}


document.documentElement.getAttribute = function () {
    return null
};

window.localStorage = {
    "getItem": function (name) {
        if (name == 'sdt_source_storage_key') {
            return '{"commonPatch":["/fe_api/burdock/v2/note/post","/api/sns/web/v1/comment/post","/api/sns/web/v1/note/like","/api/sns/web/v1/note/collect","/api/sns/web/v1/user/follow","/api/sns/web/v1/feed","/api/sns/web/v1/login/activate","/api/sns/web/v1/note/metrics_report","/api/redcaptcha","/api/store/jpd/main","/phoenix/api/strategy/getAppStrategy"],"signUrl":"https://fe-video-qc.xhscdn.com/fe-platform/6e0d0a976c31ec4cf07d8dfaea68aefe79a8c678.js","signVersion":"1","url":"https://fe-video-qc.xhscdn.com/fe-platform/2907ead001f9e4c70c446e50c36c329c2305ad25.js","reportUrl":"/api/sec/v1/shield/webprofile","desVersion":"2","validate":true}'
        }
        console.log('getItem', name)
        return ''
    }
}

window.Image = function () {
    return {}
}
window.Window = function () {
    return 'Window() { [native code] }'
}
window.requestAnimationFrame = function () {

}


// 动态环境
document.cookie = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
navigator.appVersion = '5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
navigator.userAgentData = {
    "brands": [
        {
            "brand": "Not/A)Brand",
            "version": "8"
        },
        {
            "brand": "Chromium",
            "version": "126"
        },
        {
            "brand": "Google Chrome",
            "version": "126"
        }
    ],
    "mobile": false,
    "platform": "macOS"
};


function get_enviroment(proxy_array) {
    for (var i = 0; i < proxy_array.length; i++) {
        handler = '{\n' +
            '    get: function(target, property, receiver) {\n' +
            '        console.log("方法:", "get  ", "对象:", ' +
            '"' + proxy_array[i] + '" ,' +
            '"  属性:", property, ' +
            '"  属性类型:", ' + 'typeof property, ' +
            // '"  属性值:", ' + 'target[property], ' +
            '"  属性值类型:", typeof target[property]);\n' +
            '        return target[property];\n' +
            '    },\n' +
            '    set: function(target, property, value, receiver) {\n' +
            '        console.log("方法:", "set  ", "对象:", ' +
            '"' + proxy_array[i] + '" ,' +
            '"  属性:", property, ' +
            '"  属性类型:", ' + 'typeof property, ' +
            // '"  属性值:", ' + 'target[property], ' +
            '"  属性值类型:", typeof target[property]);\n' +
            '        return Reflect.set(...arguments);\n' +
            '    }\n' +
            '}'
        eval('try{\n' + proxy_array[i] + ';\n'
            + proxy_array[i] + '=new Proxy(' + proxy_array[i] + ', ' + handler + ')}catch (e) {\n' + proxy_array[i] + '={};\n'
            + proxy_array[i] + '=new Proxy(' + proxy_array[i] + ', ' + handler + ')}')
    }
}

proxy_array = ['window', 'document', 'location', 'navigator', 'history', 'screen', 'aaa', 'target']
get_enviroment(proxy_array)

source.js 只导出了window.qg函数,位置如下
image

死循环是不是有什么事件监听导致的,可以进循环看一下,执行的什么代码。或者把代理吐出的环境到日志里查看还有没有什么没补的,如果都补了,再看看是否是由于dom环境没补导致的,我的环境里没有补dom以及一些渲染函数,你可以尝试补一下。