CoreClaw
商店
定价
开始免费试用
Kael Odin

数据集合并和去重工具

定价
Try for free
Kael Odin

数据集合并和去重工具

odin-kael/dataset-deduplication-and-merge-tool

数据集去重采集器是一款功能强大的工具,用于合并多个 JSON/JSONL 文件中的数据集并进行数据去重。该工具针对 CafeScraper 平台完成全面优化,附加增强功能,并具备完善的异常处理机制。

免费试用
免费 2,000 条结果

你可以通过 CoreClaw API,在自己的应用中以编程方式调用 Worker。在下方选择你偏好的开发语言。使用 CoreClaw API 前,需要先注册 CoreClaw 账号并获取 API 密钥——在控制台的概览页中即可找到.

<?php

// API URL
const API_URL = "https://openapi.coreclaw.com/api/v1/scraper/run";

// Your API KEY
const API_KEY = "<YOUR_API_KEY>";

// curl timeout (seconds)
const TIMEOUT = 30;

/**
 * Run scraper
 *
 * @param array $params Request parameters
 * @param string $apiKey API Key
 * @return array Return result ["success" => bool, "run_slug" => string|null, "error" => string|null]
 */
function runScraper(array $params, string $apiKey): array
{
    // Initialize cURL
    $ch = curl_init();

    // Set cURL options
    curl_setopt_array($ch, [
        CURLOPT_URL => API_URL,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => TIMEOUT,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => json_encode($params),
        CURLOPT_HTTPHEADER => [
            "api-key: " . $apiKey,
            "Content-Type: application/json"
        ],
    ]);

    // Execute request
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);

    // Close cURL
    curl_close($ch);

    // Check cURL error
    if ($error) {
        return [
            "success" => false,
            "run_slug" => null,
            "error" => "cURL error: " . $error
        ];
    }

    // Check HTTP status code
    if ($httpCode !== 200) {
        return [
            "success" => false,
            "run_slug" => null,
            "error" => "HTTP error: " . $httpCode . " - " . $response
        ];
    }

    // Parse response
    $result = json_decode($response, true);
    if (json_last_error() !== JSON_ERROR_NONE) {
        return [
            "success" => false,
            "run_slug" => null,
            "error" => "JSON decode error: " . json_last_error_msg()
        ];
    }

    // Check business error code
    if (isset($result["code"]) && $result["code"] !== 0) {
        return [
            "success" => false,
            "run_slug" => null,
            "error" => "Business error: " . (isset($result["message"]) ? $result["message"] : "Unknown error") . " (code: " . $result["code"] . ")"
        ];
    }

    // Return success result
    return [
        "success" => true,
        "run_slug" => isset($result["data"]["run_slug"]) ? $result["data"]["run_slug"] : null,
        "error" => null
    ];
}

/**
 * Main function
 */
function main()
{
    // Build request parameters
    $requestParams = [
        "scraper_slug" => "01KG2DV66JTCN65ZBTRX3M456E",
        "version" => "v1.0.8",
        "input" => [
            "parameters" => [
                "system" => [
                    "proxy_region" => "",
                    "cpus" => 0.125,
                    "memory" => 512,
                    "execute_limit_time_seconds" => 1800,
                    "max_total_charge" => 0,
                    "max_total_traffic" => 0
                ],
                "custom" => {
          'runUnits': [
                    {
                              'url': 'https://coreclaw.local/__single_run__'
                    }
          ],
          'scenario': 'ecommerce-products',
          'fields': [
                    {
                              'string': 'productId'
                    },
                    {
                              'string': 'sku'
                    }
          ],
          'mergeStrategy': 'keep-newest',
          'timestampField': 'updatedAt',
          'dataSourceType': 'direct-input',
          'inputData': '[{\'productId\': \'P001\', \'sku\': \'SKU-A-BLACK\', \'name\': \'无线蓝牙耳机 Pro\', \'price\': 299.00, \'stock\': 156, \'source\': \'京东旗舰店\', \'updatedAt\': \'2024-01-20T10:30:00\'}, {\'productId\': \'P001\', \'sku\': \'SKU-A-BLACK\', \'name\': \'无线蓝牙耳机 Pro (黑)\', \'price\': 279.00, \'stock\': 200, \'source\': \'天猫旗舰店\', \'updatedAt\': \'2024-01-22T14:20:00\'}, {\'productId\': \'P001\', \'sku\': \'SKU-A-WHITE\', \'name\': \'无线蓝牙耳机 Pro\', \'price\': 299.00, \'stock\': 88, \'source\': \'京东旗舰店\', \'updatedAt\': \'2024-01-20T10:30:00\'}, {\'productId\': \'P002\', \'sku\': \'SKU-B\', \'name\': \'智能手表 Ultra\', \'price\': 1299.00, \'stock\': 45, \'source\': \'官网\', \'updatedAt\': \'2024-01-18T09:00:00\'}]',
          'inputUrls': [
                    {
                              'url': 'https://raw.githubusercontent.com/kael-odin/worker-dedup-datasets/main/test/data1.json'
                    }
          ],
          'datasetIds': [],
          'inputFormat': 'json',
          'output': 'unique-items',
          'generateReport': true,
          'mode': 'dedup-after-load',
          'fieldsToLoad': [],
          'nullAsUnique': false,
          'parallelLoads': 10,
          'parallelPushes': 5,
          'batchSize': 5000,
          'appendFileSource': false,
          'verboseLog': false
}
            ]
        ],
        "callback_url" => "https://your-domain.com/callback"
    ];

    // Send request
    echo "Sending request to API...
";
    $result = runScraper($requestParams, API_KEY);

    // Handle result
    if ($result["success"]) {
        echo "Worker run successful!
";
        echo "Run record ID: " . $result["run_slug"] . "
";
        echo "You can use this ID to query run status and results
";
    } else {
        echo "Request failed!
";
        echo "Error message: " . $result["error"] . "
";
    }
}

// Execute main function
main();

更多资源

API 参考文档
包含所有端点和参数的完整 API 文档

定价

失败结果不计费

用户评分

5.0

开发者

Kael Odin

Worker 数据

15次 累计运行
成功率:86.67%
最后更新时间:2026.04.20

分类

Google

分享

你可能也喜欢

探索商店中更多热门采集工具

查看全部采集工具
谷歌搜索结果(SERP)抓取API

谷歌搜索结果(SERP)抓取API

by CoreClaw

通过关键词请求, 返回结构化的搜索结果摘要,包括最终搜索参数、自然结果、相关搜索以及 People Also Ask 数据。

4.8
590 次运行
低至 $1.2/1,000 结果
Google Sheets 导入导出工具

Google Sheets 导入导出工具

by Kael Odin

一款功能强大的 Google Sheets 数据导入导出工具,专用于实现 Google Sheets 与外部系统的数据同步、备份和集成。支持三种操作模式、两种认证方式、批量处理、数据去重、自动备份等功能。

5.0
2 次运行
低至 $1.2/1,000 结果
Cheerio网页抓取

Cheerio网页抓取

by Kael Odin

一款基于 Cheerio 的高速静态页面爬虫工具,专为静态 HTML 页面设计。使用 Cheerio 进行 HTML 解析,速度比完整浏览器渲染快 10-50 倍。

5.0
3 次运行
低至 $1.2/1,000 结果
Playwright 网页抓取

Playwright 网页抓取

by Kael Odin

一款使用 Playwright 进行完整浏览器渲染的强大跨浏览器网页爬虫工具。支持 Chromium、Firefox 和 WebKit 三大浏览器引擎。完美适用于动态页面、单页应用(SPA)、无限滚动页面以及跨浏览器测试场景。

5.0
4 次运行
低至 $1.2/1,000 结果
查看全部采集工具
CoreClaw

通过开箱即用的 Worker,快速搭建您的数据采集工作流。

邮箱:support@coreclaw.com

资源中心

  • 快速开始
  • API 参考
  • 销售线索
  • 联盟计划

推荐

  • 商店
  • 定价

地址

頂點數創有限公司

香港九龍大角咀通州街111號雲之端1樓9室