拼多多自动浏览商品

在网上看到一个用autojs实现的自动浏览拼多多商品的js代码感觉很有意思,但是熟悉autojs开发环境、调试摸索api等花费了我不少时间。今天我来使用一个完全不同的方法,不编程直接通过配置参数来实现,给大家提供一个参数,实现步骤如下:

创建自动构建

进入冰狐智能辅助https://aznfz.com,在网页端「移动端」/「自动构建脚本」中新建一个“构建”。

通过“元数据”构造自动构建

通过元数据可以直接复制一个完全一样的构建。在上一步创建的构建右边点击“元数据”按钮,将如下元数据拷贝进入并保存,此时系统会根据元数据自动完成模块参数配置。

{
    "type": "root",
    "children": [{
        "type": "declareVar",
        "var": [{
            "name": "temp",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "ret",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "view",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "viewContainer",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "tag",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "item",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "index",
            "type": "normal",
            "initType": "null",
            "initValue": "null"
        }, {
            "name": "data",
            "type": "normal",
            "initType": "string",
            "initValue": ""
        }, {
            "name": "text",
            "type": "normal",
            "initType": "string",
            "initValue": ""
        }]
    }, {
        "type": "main",
        "desc": "业务逻辑入口",
        "debug": false,
        "params": [],
        "children": [{
            "type": "launchApp",
            "desc": "启动APP",
            "debug": false,
            "packageName": "com.xunmeng.pinduoduo",
            "tag": "txt:推荐#",
            "failed": "",
            "maxStep": "30",
            "children": [{
                "type": "scroll",
                "desc": "滚动处理",
                "class": 1,
                "debug": false,
                "direction": "up",
                "tag": "",
                "family": [],
                "descendant": [],
                "widgetIndex": "0",
                "minDistance": "0.8",
                "maxDistance": "0.8",
                "minScrollCount": "2",
                "maxScrollCount": "3",
                "minDuration": "500",
                "maxDuration": "500",
                "beforeWait": "1000",
                "afterWait": "1000"
            }, {
                "type": "loop",
                "desc": "循环处理",
                "class": "2",
                "debug": false,
                "minCount": "2",
                "maxCount": "5",
                "indexVarName": "index0",
                "children": [{
                    "type": "traverse",
                    "desc": "遍历容器",
                    "class": 1,
                    "debug": false,
                    "tag": "cn:android.support.v4.view.ViewPager#",
                    "family": [1, 1],
                    "descendant": [],
                    "failed": "",
                    "traverseSelf": false,
                    "retryCount": "0",
                    "startIndex": "0",
                    "lastIndex": "0",
                    "randomPickCount": "1",
                    "clickable": false,
                    "className": "",
                    "children": [{
                        "type": "clickAndEnter",
                        "desc": "点击进入页面",
                        "class": "2",
                        "debug": false,
                        "family": [],
                        "descendant": [],
                        "checkTag": "txt:发起拼单#",
                        "mode": "2",
                        "failed": "",
                        "duration": "500",
                        "maxStep": "5",
                        "beforeWait": "0",
                        "afterWait": "0",
                        "target": "item",
                        "children": [{
                            "type": "scroll",
                            "desc": "滚动处理",
                            "class": 1,
                            "debug": false,
                            "direction": "up",
                            "tag": "",
                            "family": [],
                            "descendant": [],
                            "widgetIndex": "0",
                            "minDistance": "0.8",
                            "maxDistance": "0.8",
                            "minScrollCount": "3",
                            "maxScrollCount": "5",
                            "minDuration": "500",
                            "maxDuration": "500",
                            "beforeWait": "1000",
                            "afterWait": "3000"
                        }, {
                            "type": "back2Page",
                            "desc": "返回页面",
                            "debug": false,
                            "tag": "txt:首页#",
                            "root": "",
                            "backFirst": "true",
                            "failed": "",
                            "duration": "500",
                            "maxStep": "5",
                            "beforeWait": "0",
                            "afterWait": "0"
                        }]
                    }]
                }, {
                    "type": "scroll",
                    "desc": "滚动处理",
                    "class": 1,
                    "debug": false,
                    "direction": "up",
                    "tag": "",
                    "family": [],
                    "descendant": [],
                    "widgetIndex": "0",
                    "minDistance": "0.8",
                    "maxDistance": "0.8",
                    "minScrollCount": "2",
                    "maxScrollCount": "3",
                    "minDuration": "500",
                    "maxDuration": "500",
                    "beforeWait": "1000",
                    "afterWait": "1000"
                }]
            }]
        }]
    }],
    "desc": "根模块",
    "debug": false
}

编译运行

    1. 在网页端「移动端」/「自动构建脚本」点击右边的“编译”按钮,将自动构建编译成与自动构建名称相同的js脚本。
    2. 在网页端「移动端」/「移动端脚本」点击右边的“发布”按钮发布脚本。
    3. 在网页端「移动端」/「移动端脚本」点击右边的“运行”按钮,并选择设备,然后执行。
posted on 2022-07-02 15:12  jeff_hf  阅读(436)  评论(0)    收藏  举报