项目介绍

piotrv1001/how-to-scrape-dhgate-in-nodejs 是一个托管在 GitHub 上的开源项目,主要使用 JavaScript 编写,目前获得 1 个 Star、0 次 Fork。

仓库全名
piotrv1001/how-to-scrape-dhgate-in-nodejs
Star 数
1

README 摘要

How to Scrape DHgate in Node.js A minimal Node.js example showing how to scrape DHgate product listings using the DHgate Listings Scraper actor on Apify. Instead of building a scraper from scratch with Playwright or Cheerio, this example calls a ready-made Apify actor that handles the heavy lifting — search URL parsing, pagination, and structured data extraction. What this example does Calls the…

完整内容见 GitHub 原始 README 或本页 。

常见问题

how-to-scrape-dhgate-in-nodejs 用什么语言开发?

主要使用 JavaScript 编写,目前有 1 个 Star。

如何获取 how-to-scrape-dhgate-in-nodejs 的源码?

可以直接克隆仓库:git clone https://github.com/piotrv1001/how-to-scrape-dhgate-in-nodejs.git,默认分支为 main;安装与运行步骤见仓库 README。

how-to-scrape-dhgate-in-nodejs 最近还在维护吗?

仓库最近一次更新为 5月9日,当前没有未关闭的 Issue;Star 数为 1,可作为社区活跃度的参考。

关于

How to scrape DHgate product listings in Node.js using the Apify DHgate Listings Scraper actor.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
1
价值分
0
活跃状态
活跃

语言占比

JavaScript

贡献者

README

How to Scrape DHgate in Node.js

A minimal Node.js example showing how to scrape DHgate product listings using the DHgate Listings Scraper actor on Apify. Instead of building a scraper from scratch with Playwright or Cheerio, this example calls a ready-made Apify actor that handles the heavy lifting — search URL parsing, pagination, and structured data extraction.

DHgate Listings Scraper results

What this example does

  • Calls the piotrv1001/dhgate-listings-scraper Apify actor
  • Passes a DHgate search URL as input
  • Waits for the actor run to finish
  • Fetches results from the run’s dataset
  • Prints each product listing to the console

Prerequisites

Installation

npm install

Environment setup

Copy .env.example to .env and add your Apify API token:

cp .env.example .env
APIFY_TOKEN=your_apify_token_here

Usage

npm start

Code example

import { ApifyClient } from 'apify-client';
import 'dotenv/config';

// Initialize the ApifyClient with your Apify API token
// Set APIFY_TOKEN in your .env file (copy .env.example to get started)
const client = new ApifyClient({
    token: process.env.APIFY_TOKEN,
});

// Prepare Actor input
const input = {
    "searchUrls": [
        "https://www.dhgate.com/w/sneakers.html?dspm=pcen.hp.hotsearch.5.PyrNzJX8tC4mkXEVKusV&resource_id=#listing_hot-sneakers"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/dhgate-listings-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

Example output

See sample-output.json for a full example of what the actor returns. Each product listing includes:

  • itemCode and productId — DHgate identifiers
  • productName and alt — product title and image alt text
  • productDetailUrl — direct link to the product page
  • imageUrl — product thumbnail
  • price and minOrder — pricing and minimum order quantity
  • feedbackPercent, reviewCount, recentlySold — seller and product stats
  • sellerStoreUrl — link to the seller’s store
  • freeShipping — boolean shipping flag
  • coupons — array of available coupon codes

Use cases

  • Price monitoring — track DHgate prices for specific product categories over time
  • Product research — find trending sneakers, electronics, or apparel for resale
  • Competitive analysis — benchmark seller pricing and reviews
  • Dropshipping product discovery — surface high-rated, free-shipping products
  • Market data pipelines — feed structured DHgate listings into analytics dashboards

Try the actor on Apify

Open the DHgate Listings Scraper on Apify

License

MIT

评论

暂无评论