๐ŸŽ Get the FREE AI Skills Starter Guide โ€” Subscribe โ†’
BytesAgainBytesAgain
๐Ÿฆ€ ClawHub

Ecommerce Logistics

by @charles-lpf

Aggregate logistics information from Taobao, JD, PDD, and Douyin. One-click query for multi-platform order tracking. Supports persistent cookie storage and Q...

Versionv1.0.0
Downloads328
TERMINAL
clawhub install ecommerce-logistics

๐Ÿ“– About This Skill


name: ecommerce-logistics description: "Aggregate logistics information from Taobao, JD, PDD, and Douyin. One-click query for multi-platform order tracking. Supports persistent cookie storage and QR code login. Use when user asks to check orders, track packages from shopping platforms, or mentions ๆท˜ๅฎ/ไบฌไธœ/ๆ‹ผๅคšๅคš/ๆŠ–้Ÿณ ็‰ฉๆต/่ฎขๅ•."

E-commerce Logistics Aggregator๏ผˆ็”ตๅ•†็‰ฉๆต่šๅˆ๏ผ‰

Query order logistics from Taobao, JD.com, Pinduoduo, and Douyin with persistent authentication.

Features

  • ๐Ÿ”— Multi-platform: Taobao, PDD (JD & Douyin not supported due to anti-bot)
  • ๐Ÿ”’ Persistent login: Cookie storage, no repeated logins
  • ๐Ÿ›ก๏ธ Stealth mode: Bypass basic anti-bot detection
  • โฑ๏ธ Rate limiting: Built-in request throttling
  • ๐Ÿ“ฑ QR login: Graceful handling of expired sessions
  • ๐Ÿšš In-transit filter: Only show orders currently in transit
  • Setup

    # Install dependencies
    cd scripts && npm install

    Required environment variables (optional, for headless operation)

    export ECOM_LOGISTICS_DATA_DIR="$HOME/.ecommerce-logistics"

    Usage

    First Time: Login to Platforms

    cd scripts

    Login to Taobao (opens browser for QR scan)

    npm run query -- --platform taobao --login

    Login to PDD

    npm run query -- --platform pdd --login

    Note: JD and Douyin are not supported due to strict anti-bot measures

    Query Logistics

    # Query all platforms (requires prior login)
    npm run query -- --all

    Query specific platform

    npm run query -- --platform taobao npm run query -- --platform pdd

    Query with custom data directory

    npm run query -- --all --data-dir /path/to/cookies

    Run in headless mode (no browser window)

    npm run query -- --all --headless

    QR Login Process

    When cookies are missing or expired:

    1. The skill opens a browser window with the platform login page 2. A QR code screenshot is saved to ~/.ecommerce-logistics/{platform}-qr.png 3. Scan the QR code with the platform's mobile app 4. Complete login in the browser window 5. Cookies are automatically saved for future use

    Note: If you see "Cookie ๅทฒ่ฟ‡ๆœŸ๏ผŒ้œ€่ฆ้‡ๆ–ฐ็™ปๅฝ•", run the login command again.

    Cookie Storage

    Cookies are stored encrypted in:

  • Default: ~/.ecommerce-logistics/cookies/
  • Each platform has separate cookie file
  • Auto-refresh on expiration
  • Architecture

    scripts/src/
    โ”œโ”€โ”€ index.ts              # CLI entry
    โ”œโ”€โ”€ core/
    โ”‚   โ”œโ”€โ”€ aggregator.ts     # Main orchestrator
    โ”‚   โ”œโ”€โ”€ auth-manager.ts   # Cookie & QR login
    โ”‚   โ”œโ”€โ”€ rate-limiter.ts   # Request throttling
    โ”‚   โ””โ”€โ”€ stealth-browser.ts # Anti-detection browser
    โ”œโ”€โ”€ adapters/
    โ”‚   โ”œโ”€โ”€ base-adapter.ts   # Abstract base class
    โ”‚   โ”œโ”€โ”€ taobao-adapter.ts
    โ”‚   โ”œโ”€โ”€ jd-adapter.ts
    โ”‚   โ”œโ”€โ”€ pdd-adapter.ts
    โ”‚   โ””โ”€โ”€ douyin-adapter.ts
    โ””โ”€โ”€ types/
        โ””โ”€โ”€ index.ts          # TypeScript interfaces

    references/ โ””โ”€โ”€ selectors.md # Platform-specific CSS selectors

    Error Handling

    | Error | Handling | |-------|----------| | Cookie expired | Prompt QR re-login | | Rate limited | Auto-backoff retry | | Login page detected | Graceful error with instructions | | Network timeout | 3 retries with exponential backoff |

    Platform Support Status

    | Platform | Status | Notes | |----------|--------|-------| | Taobao | โœ… Available | Order list + logistics info | | JD | โŒ Unsupported | Anti-bot detection too strict | | PDD | โœ… Available | Order list + tracking number + pickup code | | Douyin | โŒ Unsupported | Requires mobile app access |

    Implementation Notes

    Anti-Detection Measures

    The skill implements several stealth techniques:

    1. navigator.webdriver override - Hides automation flag 2. Plugins spoofing - Simulates real browser plugins 3. Viewport & User-Agent - Uses realistic desktop/mobile profiles 4. Permissions API - Overrides notification permissions 5. Playwright-specific cleanup - Removes __playwright properties

    Rate Limiting

    Each platform has independent rate limits:

    | Platform | Max Requests | Window | |----------|-------------|--------| | Taobao | 10 | 60s | | JD | 15 | 60s | | PDD | 8 | 60s | | Douyin | 10 | 60s |

    Cookie Expiration

  • Cookies are considered expired after 30 days
  • Expired cookies trigger QR re-login prompt
  • Each platform stores cookies independently
  • Development

    Updating Selectors

    Platform websites change frequently. Update selectors in:

  • references/selectors.md - Documentation
  • src/adapters/*-adapter.ts - Implementation
  • Testing

    # Compile TypeScript
    cd scripts && npm run build

    Run in development mode

    npm run dev -- --platform taobao

    Debug with visible browser

    npm run query -- --platform taobao --headless=false

    ๐Ÿ’ก Examples

    First Time: Login to Platforms

    cd scripts

    Login to Taobao (opens browser for QR scan)

    npm run query -- --platform taobao --login

    Login to PDD

    npm run query -- --platform pdd --login

    Note: JD and Douyin are not supported due to strict anti-bot measures

    Query Logistics

    # Query all platforms (requires prior login)
    npm run query -- --all

    Query specific platform

    npm run query -- --platform taobao npm run query -- --platform pdd

    Query with custom data directory

    npm run query -- --all --data-dir /path/to/cookies

    Run in headless mode (no browser window)

    npm run query -- --all --headless

    QR Login Process

    When cookies are missing or expired:

    1. The skill opens a browser window with the platform login page 2. A QR code screenshot is saved to ~/.ecommerce-logistics/{platform}-qr.png 3. Scan the QR code with the platform's mobile app 4. Complete login in the browser window 5. Cookies are automatically saved for future use

    Note: If you see "Cookie ๅทฒ่ฟ‡ๆœŸ๏ผŒ้œ€่ฆ้‡ๆ–ฐ็™ปๅฝ•", run the login command again.

    โš™๏ธ Configuration

    # Install dependencies
    cd scripts && npm install

    Required environment variables (optional, for headless operation)

    export ECOM_LOGISTICS_DATA_DIR="$HOME/.ecommerce-logistics"