Skip to content

Veeeetzzzz/tag-sales-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

92 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TAG Sales Scraper 🎴

A modern web application that tracks Pokemon TAG graded card sales from eBay, with intelligent card matching and price analytics, use the hosted version or download and run locally with all the card information - both run super fast.

Homepage

image

Card Matcher

image

πŸš€ Features

  • Real-time eBay Scraping: Automatically fetches sold TAG graded Pokemon cards
  • Smart Card Matching: Fuzzy matching algorithm links sales to specific cards
  • Individual Card Analytics: Price trends, statistics, and variant tracking
  • Currency Conversion: Toggle between GBP and USD with real-time conversion
  • Local Caching: Browser localStorage for instant loading
  • Responsive Design: Works on desktop and mobile
  • Open Source: Card database hosted on GitHub

πŸ—οΈ Architecture

Data Flow

eBay β†’ Scraper β†’ Card Matcher β†’ Frontend Display
                      ↓
              Card Database (JSON)

Card Matching System

The application uses a sophisticated matching algorithm:

  1. Keyword Matching: Each card has multiple matching keywords
  2. Fuzzy Matching: Handles spelling variations and abbreviations
  3. Variant Detection: Automatically detects Regular/Full Art/Rainbow variants
  4. Confidence Scoring: 60%+ confidence threshold for matches

File Structure

/data/cards/
  └── tag-team-cards.json    # Card database
/pages/
  β”œβ”€β”€ index.js               # All sales view
  β”œβ”€β”€ cards.js               # Individual card view
  └── api/
      β”œβ”€β”€ ebay.js            # eBay scraper
      └── card-matcher.js    # Card matching service

πŸ“Š Card Database Schema

{
  "setInfo": {
    "name": "TAG Graded Cards",
    "description": "Pokemon TAG graded cards from various sets",
    "lastUpdated": "2024-06-01"
  },
  "cards": [
    {
      "id": "tag-001",
      "name": "Pikachu & Zekrom-GX",
      "setName": "Team Up",
      "setCode": "TEU",
      "cardNumber": "33",
      "rarity": "Ultra Rare",
      "type": ["Electric"],
      "hp": 240,
      "artist": "Mitsuhiro Arita",
      "matchingKeywords": [
        "Pikachu Zekrom",
        "Pikachu & Zekrom",
        "PikachuZekrom",
        "Pika Zek",
        "TEU 33",
        "Team Up 33"
      ],
      "imageUrl": "https://images.pokemontcg.io/sm9/33_hires.png",
      "variants": [
        {
          "variant": "Regular",
          "condition": "NM",
          "marketPrice": 15.00
        }
      ]
    }
  ]
}

πŸ”§ Key Components

Hybrid Scraping Approach

  • Primary: fetch + cheerio (Vercel-compatible)
  • Fallback: Playwright (local development)
  • Resilient: Graceful degradation between methods

Card Matching Algorithm

  • Multi-keyword matching: Handles various name formats
  • Variant detection: Regular, Full Art, Rainbow Rare
  • Confidence scoring: Ensures accurate matches
  • Statistics calculation: Price trends and analytics

Currency Conversion System

  • Multi-currency support: GBP and USD with automatic detection
  • Real-time conversion: Converts all prices based on user preference
  • Persistent settings: Currency choice saved in localStorage
  • Exchange rate API: Extensible for real-time rate updates

Caching Strategy

  • Browser localStorage: Instant loading for users
  • Timestamp tracking: Shows data freshness
  • Error handling: "Failed to update" with last refresh time

πŸš€ Getting Started

# Install dependencies
npm install

# Run development server
npm run dev

# Build for production
npm run build

πŸ“ˆ Adding New Cards

  1. Edit /data/cards/tag-team-cards.json
  2. Add card with comprehensive matchingKeywords array
  3. Include multiple name variations and set codes
  4. Deploy - matches will work automatically

Matching Keywords Tips

  • Include full card name
  • Add abbreviated versions ("Pika Zek")
  • Include set code + number ("TEU 33")
  • Add common misspellings
  • Include symbol variations ("&" vs "and")

🎯 Future Enhancements

  • Historical price charts
  • Multiple set support
  • Price alerts
  • Market trend analysis
  • Mobile app
  • User watchlists

🀝 Contributing

This is an open-source project! Contributions welcome:

  1. Card Database: Add missing cards to JSON files
  2. Matching Keywords: Improve keyword arrays for better matching
  3. Features: Add new functionality
  4. Bug Fixes: Report and fix issues

πŸ“Š Performance

  • Card Matching: ~100ms for 60 sales against 50+ cards
  • Scraping: ~3-5 seconds for full eBay results
  • Caching: Instant load from localStorage
  • Matching Accuracy: 85%+ with confidence scoring

πŸ” API Endpoints

  • GET /api/ebay - Fetch latest sales data
  • POST /api/card-matcher - Match sales to cards
    {
      "sales": [/* eBay sales array */]
    }
  • GET /api/exchange-rates - Get current exchange rates
    {
      "success": true,
      "base": "GBP",
      "rates": {
        "GBP": 1.0,
        "USD": 1.27
      },
      "timestamp": "2024-01-01T00:00:00.000Z"
    }

Built with Next.js, Tailwind CSS, and lots of β˜•

About

This site shows you all the TAG (Technical Authentication & Grading) sales on eBay.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors