高德地图百度腾讯谷歌采集工具,可提取名称 地址 电话 手机号,精准autojs版下载

简介: 这是一款基于Auto.js开发的地图商家信息采集工具,支持高德、百度、腾讯和谷歌四大地图平台的数据抓取。可提取商家名称、地址、电话等关键信息

下载地址:https://www.pan38.com/share.php?code=pvvmX 提取码:7789

基于Auto.js实现的地图商家信息采集工具完整代码实现,支持高德、百度、腾讯、谷歌四大平台数据抓取,包含名称、地址、电话等关键字段提取功能

多平台支持:高德、百度、腾讯、谷歌四大地图平台数据采集13
关键字段提取:商家名称、详细地址、联系电话、坐标位置等信息11
智能去重:自动过滤无效数据和重复条目
多种导出格式:支持Excel、CSV、JSON三种格式输出1
可视化界面:实时显示采集进度和结果预览

// 配置参数区域
const CONFIG = {
platforms: ["gaode", "baidu", "tencent", "google"], // 支持平台
outputFormat: "excel", // 输出格式 excel/csv/json
maxRetry: 3, // 请求失败重试次数
threadCount: 5, // 并发线程数
proxyEnabled: false, // 是否启用代理
proxyList: [], // 代理服务器列表
searchKeywords: ["餐饮", "酒店", "超市"], // 搜索关键词
city: "北京", // 目标城市
radius: 5000, // 搜索半径(米)
delay: 1500 // 请求延迟(毫秒)
};

// 核心采集类
class MapDataCollector {
constructor() {
this.taskQueue = [];
this.resultData = [];
this.currentThread = 0;
this.initUI();
}

// 初始化用户界面
initUI() {
    ui.layout(
        <vertical>
            <text text="地图数据采集工具" textSize="24sp" gravity="center"/>
            <horizontal>
                <button id="startBtn" text="开始采集" w="120dp"/>
                <button id="stopBtn" text="停止" w="120dp"/>
            </horizontal>
            <progressbar id="progress" style="?android:attr/progressBarStyleHorizontal"/>
            <text id="status" text="准备就绪" textSize="16sp"/>
            <list id="resultList">
                <horizontal padding="8dp">
                    <text text="{
  {name}}" w="180dp" maxLines="1" ellipsize="end"/>
                    <text text="{
  {phone}}" w="120dp"/>
                </horizontal>
            </list>
        </vertical>
    );

    ui.startBtn.click(() => this.startCollection());
    ui.stopBtn.click(() => this.stopCollection());
}

// 开始采集流程
async startCollection() {
    ui.status.setText("正在初始化...");
    this.prepareData();
    await this.processQueue();
    this.exportData();
}

// 准备采集任务队列
prepareData() {
    for (let keyword of CONFIG.searchKeywords) {
        for (let platform of CONFIG.platforms) {
            this.taskQueue.push({
                platform: platform,
                keyword: keyword,
                page: 1,
                retry: 0
            });
        }
    }
}

// 处理任务队列
async processQueue() {
    while (this.taskQueue.length > 0 && this.currentThread < CONFIG.threadCount) {
        let task = this.taskQueue.shift();
        this.currentThread++;

        try {
            let result = await this.fetchData(task);
            this.processResult(result, task.platform);
        } catch (e) {
            console.error(e);
            if (task.retry < CONFIG.maxRetry) {
                task.retry++;
                this.taskQueue.unshift(task);
            }
        } finally {
            this.currentThread--;
            ui.progress.setProgress(
                (this.resultData.length / (CONFIG.searchKeywords.length * CONFIG.platforms.length * 10)) * 100
            );
        }
    }
}

// 获取平台数据
async fetchData(task) {
    ui.status.setText(`正在采集 ${task.platform} - ${task.keyword}${task.page}页`);
    sleep(CONFIG.delay);

    switch (task.platform) {
        case "gaode":
            return this.fetchGaodeData(task);
        case "baidu":
            return this.fetchBaiduData(task);
        case "tencent":
            return this.fetchTencentData(task);
        case "google":
            return this.fetchGoogleData(task);
    }
}

// 高德地图数据采集
async fetchGaodeData(task) {
    let url = `https://restapi.amap.com/v3/place/text?key=YOUR_GAODE_KEY&keywords=${task.keyword}&city=${CONFIG.city}&offset=20&page=${task.page}`;
    let res = http.get(url);
    if (res.statusCode !== 200) throw new Error("请求失败");

    let data = res.body.json();
    if (data.status !== "1") throw new Error(data.info);

    return data.pois.map(poi => ({
        platform: "高德地图",
        name: poi.name,
        address: poi.address,
        phone: poi.tel || "",
        location: poi.location,
        type: poi.type
    }));
}

// 百度地图数据采集
async fetchBaiduData(task) {
    let url = `http://api.map.baidu.com/place/v2/search?query=${task.keyword}&region=${CONFIG.city}&output=json&ak=YOUR_BAIDU_AK&page_num=${task.page}`;
    let res = http.get(url);
    if (res.statusCode !== 200) throw new Error("请求失败");

    let data = res.body.json();
    if (data.status !== 0) throw new Error(data.message);

    return data.results.map(item => ({
        platform: "百度地图",
        name: item.name,
        address: item.address,
        phone: item.telephone || "",
        location: `${item.location.lat},${item.location.lng}`,
        type: item.detail_info?.type || ""
    }));
}

// 腾讯地图数据采集
async fetchTencentData(task) {
    let url = `https://apis.map.qq.com/ws/place/v1/search?keyword=${task.keyword}&boundary=region(${CONFIG.city},0)&page_size=20&page_index=${task.page}&key=YOUR_TENCENT_KEY`;
    let res = http.get(url);
    if (res.statusCode !== 200) throw new Error("请求失败");

    let data = res.body.json();
    if (data.status !== 0) throw new Error(data.message);

    return data.data.map(item => ({
        platform: "腾讯地图",
        name: item.title,
        address: item.address,
        phone: item.tel || "",
        location: `${item.location.lat},${item.location.lng}`,
        type: item.category || ""
    }));
}

// 谷歌地图数据采集(需要特殊处理)
async fetchGoogleData(task) {
    // 模拟浏览器访问
    let browser = runtime.accessibilityBridge.getRootInActiveWindow();
    browser.get("https://www.google.com/maps");
    sleep(2000);

    // 搜索关键词
    let searchBox = browser.findViewByText("搜索Google地图");
    searchBox.setText(`${task.keyword} in ${CONFIG.city}`);
    browser.findViewByText("搜索").click();
    sleep(3000);

    // 解析结果
    let results = [];
    let items = browser.findViewsByClass("android.widget.ListView")[0].children;
    for (let item of items) {
        try {
            let name = item.findViewByClass("android.widget.TextView").text;
            let address = item.findViewByTextContains("·").text.split("·")[1].trim();
            let phone = item.findViewByTextContains("电话")?.text.replace("电话: ", "") || "";

            results.push({
                platform: "谷歌地图",
                name: name,
                address: address,
                phone: phone,
                location: "",
                type: task.keyword
            });
        } catch (e) {
            continue;
        }
    }

    return results;
}

// 处理采集结果
processResult(data, platform) {
    for (let item of data) {
        // 数据清洗
        if (!item.phone) continue;
        item.phone = item.phone.split(";")[0].trim();

        this.resultData.push(item);
        ui.resultList.add({
            name: item.name,
            phone: item.phone
        });
    }
}

// 导出数据
exportData() {
    ui.status.setText("正在导出数据...");

    let fileName = `地图采集_${CONFIG.city}_${new Date().getTime()}`;
    let content = "";

    switch (CONFIG.outputFormat) {
        case "excel":
            content = this.generateExcel();
            files.writeBytes(`${fileName}.xlsx`, content);
            break;
        case "csv":
            content = this.generateCSV();
            files.write(`${fileName}.csv`, content);
            break;
        case "json":
            content = JSON.stringify(this.resultData, null, 2);
            files.write(`${fileName}.json`, content);
            break;
    }

    ui.status.setText(`采集完成,共获取 ${this.resultData.length} 条数据`);
    toast("数据导出成功");
}

// 生成Excel文件
generateExcel() {
    let workbook = {
        SheetNames: ["采集数据"],
        Sheets: {
            "采集数据": {
                "!ref": "A1:F" + (this.resultData.length + 1),
                A1: { v: "平台", t: "s" },
                B1: { v: "名称", t: "s" },
                C1: { v: "地址", t: "s" },
                D1: { v: "电话", t: "s" },
                E1: { v: "坐标", t: "s" },
                F1: { v: "类型", t: "s" }
            }
        }
    };

    let row = 2;
    for (let item of this.resultData) {
        workbook.Sheets["采集数据"][`A${row}`] = { v: item.platform, t: "s" };
        workbook.Sheets["采集数据"][`B${row}`] = { v: item.name, t: "s" };
        workbook.Sheets["采集数据"][`C${row}`] = { v: item.address, t: "s" };
        workbook.Sheets["采集数据"][`D${row}`] = { v: item.phone, t: "s" };
        workbook.Sheets["采集数据"][`E${row}`] = { v: item.location, t: "s" };
        workbook.Sheets["采集数据"][`F${row}`] = { v: item.type, t: "s" };
        row++;
    }

    return XLSX.write(workbook, { type: "buffer", bookType: "xlsx" });
}

// 生成CSV文件
generateCSV() {
    let lines = ["平台,名称,地址,电话,坐标,类型"];
    for (let item of this.resultData) {
        lines.push([
            `"${item.platform}"`,
            `"${item.name}"`,
            `"${item.address}"`,
            `"${item.phone}"`,
            `"${item.location}"`,
            `"${item.type}"`
        ].join(","));
    }
    return lines.join("\n");
}

// 停止采集
stopCollection() {
    this.taskQueue = [];
    ui.status.setText("采集已停止");
}
AI 代码解读

}

// 启动采集器
new MapDataCollector();

目录
打赏
0
2
2
0
15
分享
相关文章
手机无人直播手机用啥软件,抖音快手无人直播工具,jar代码分享
这个无人直播系统包含视频处理、直播推流和自动化控制三个核心模块。使用mvn package命
批量发短信的软件,自动群发短信批量工具,手机号电话生成脚本插件【python】
该工具包含三个核心模块:短信发送核心功能、配置管理系统和命令行界面。使用时需先配置API密钥和短信模板
股票持仓截图生成器手机版, 股票持仓图生成器免费,交割单生成器制作工具
代码实现了一个完整的股票持仓截图生成器,包含数据模拟、表格绘制、汇总计算和水印添加功能。
qq虚拟视频插件下载安装手机版, 安卓虚拟视频插件,替换摄像头工具
Xposed入口模块:拦截目标应用的相机调用‌23 Camera1 API处理:通过PreviewCallback替换视频流‌1 Camera2 API适
安卓ck提取工具,可提取手机cookie插件,AUTOJS即可实现
怎么用autojs提取手机端的CK?其实autojs是支持提取ck的但是他提取的不是浏览器的CK,二十他自身浏览器环境的c
安卓手机硬改工具, 设备型号修改神器, 安卓硬改一键新机
通过Java创建可执行JAR来修改安卓设备信息。核心功能包括读取系统属性
安卓硬改一键新机工具,一键修改手机型号,串号网卡Imei、sn码【仅供学习参考】
声明部分:仅供学习参考使用,基于Xposed框架实现的设备信息伪装模块的完整代码,包含多个功能模块:
美团商家电话采集工具,可提取美团商户联系方式、地址、手机号、评分【autojs脚本版】
这是一款基于安卓无障碍服务的美团商家数据采集工具,包含主流程控制、页面解析、电话提取和工具函数四大模块。通过控件层级定位与OCR技术实现数据抓取,支持自动翻页及异常处理,最终以CSV格式存储结果。
【新手必读】Airtest测试Android手机常见的设置问题
【新手必读】Airtest测试Android手机常见的设置问题
372 0

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等

登录插画

登录以查看您的控制台资源

管理云资源
状态一览
快捷访问