Skip to content

sam9525/pokemon-tcgp-data-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pokemon tcgp scripts

Build the scripts for my website Pokemon TCG Pocket Data (GitHub).

pokemon_crawler.py

A web crawler to crawl Pokemon cards names from Pokemon-Zone.

Important

The script is design for python below 3.13.

Requirements

  • Python < 3.13
  • async_playwright
  • pandas

Arguments

  • --exorp: Expansion (e) or pack key (p).
  • --set: Set code to crawl (A1, A2, etc.).
  • --pack-key: Pack key to crawl (AN001_0020_00_000, etc.).
  • --pack-name: Pack name to crawl (Charizard, etc.).

Usage Example

py -3.11 pokemon_crawler.py \
          --exorp e \
          --set A1 \
          --pack-key AN001_0020_00_000 \
          --pack-name Charizard

rename_images.py

A script that renames all images in a folder based on an Excel file. The script reads the image name from the Excel file and appends the folder name to the end of each image filename.

The Excel files can be obtained using the script pokemon_crawler.py—only need to crawl the expansion.

PK_10_000110_00 -> cPK_10_000110_00_NAZONOKUSA_C_{folder_name}

Note

The images is expected to be downloaded from Google Drive

Requirements

  • pandas

Arguments

  • --folder (Multiple): Folder path to rename images, separate by space.
  • --excel-file: Excel file path.
  • --dry-run (Default): Enable dry run mode (no changes).
  • --no-dry-run: Disable dry run mode (execute changes).

Usage Example

py rename_images.py \
    --folder "path/to/folder" "path/to/folder" \
    --excel-file "path/to/excel/file"

generate_card_json.py

A script that generates card JSON from images and Excel files. It matches each image to the corresponding Excel file, ensuring no duplicate cards appear within the same pack (though duplicates can exist across different packs). The script uses icon list to determine card type in the specific position (top right) in the image.

Requirements

  • pandas

Arguments

  • --image-folder: Folder path to images.
  • --excel-files (Multiple): Excel file paths, separate by space.
  • --output-name: Output file name.

Usage Example

py generate_card_json.py \
    --image-folder "path/to/image/folder" \
    --excel-files "path/to/excel/file" "path/to/excel/file" \
    --output-name "path/to/output/file"

generate_special_card_json.py

A script that generates special card JSON from images and Excel files (duplicate cards JSON). The script uses an icon list to determine:

  • Card type from the top-right position in the image
  • Card fight energy from the bottom-left position
  • Card weakness from the bottom-right position
  • Whether the card is a trainer or tool from the color of the top-left position

Requirements

  • pandas
  • numpy
  • cv2

Arguments

  • --image-folder: Folder path to images.
  • --duplicate-list: Duplicate list file path.
  • --output-name: Output file name.

Usage Example

py generate_special_card_json.py \
    --image-folder "path/to/image/folder" \
    --duplicate-list "path/to/duplicate/list" \
    --output-name "path/to/output/file"

Special Card Detect Example

Card Detect Example

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages