8000 GitHub - Belacosaur/NFT-Image-Fetcher
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Belacosaur/NFT-Image-Fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

NFT Image Fetcher for Solana Collections (DeGods Example)

This Python script downloads all NFT images from a specific Solana collection, using the Helius Digital Asset Standard (DAS) API. It's currently configured to download images from the DeGods collection as an example.

Features

  • Fetches NFT details using the Helius DAS API (getAssetsByGroup method).
  • Handles pagination to retrieve all assets in a collection.
  • Parses metadata to find image URLs (including from json_uri and direct files entries).
  • Handles Arweave (ar://) image URLs.
  • Saves images into a structured directory (nft_images/COLLECTION_NAME/).
  • Robust error handling for API requests and image downloads.

Prerequisites

Installation

  1. Clone the repository (or download the script):

    # If you've set up a Git repo:
    git clone https://github.com/YOUR_USERNAME/NFT-Image-Fetcher.git
    cd NFT-Image-Fetcher

    Alternatively, download solana_nft_image_downloader.py directly into a folder on your computer.

  2. Install the required Python library: The script primarily uses the requests library. If you don't have it, install it via pip:

    pip install requests

How to Use

  1. Navigate to the script's directory: Open your terminal or command prompt and change to the directory where solana_nft_image_downloader.py is located.

  2. Run the script:

    python solana_nft_image_downloader.py
  3. Enter your Helius API Key: When prompted, enter your Helius API key. The script will attempt to parse the key even if you paste a full Helius RPC URL containing the API key.

    This script will download images for the DeGods collection (6XxjKYFbcndh2gDcsUrmZgVEsoDxXMnfsaGY6fpTJzNr).
    It uses the Helius Digital Asset Standard (DAS) API.
    Enter your Helius API Key: YOUR_API_KEY_HERE
    
  4. Download Process:

    • The script will first fetch the list of all NFTs in the DeGods collection using the Helius API. This may take a few moments depending on the collection size and API response times.
    • Once the list is retrieved, it will proceed to download the image for each NFT.
    • Images will be saved in a folder named nft_images/DeGods/ within the same directory as the script.
    • The console will show progress and any errors encountered.

Configuration for Other Collections

To adapt this script for a different Solana NFT collection:

  1. Find the Collection Mint Address: Locate the verified "Collection Mint" address for the target collection. You can usually find this on Solana explorers like Solscan or NFT marketplaces by looking at the details of an NFT from that collection.

  2. Update the Script: Open solana_nft_image_downloader.py in a text editor and modify these lines at the top of the script:

    # DeGods Collection Mint Address (verified collection key)
    DEGCDS_COLLECTION_MINT_ADDRESS = "NEW_COLLECTION_MINT_ADDRESS_HERE"
    # ...
    # In main():
    collection_name = "YourNewCollectionName" # For directory naming
    • Replace "NEW_COLLECTION_MINT_ADDRESS_HERE" with the actual collection mint address.
    • Change "DeGods" in the collection_name variable assignment within the main() function to a suitable name for your collection (this will be used for the output directory).

Important Notes

  • Helius API Key: A valid Helius API key is essential for this script to function. The free tier should be sufficient for moderate use, but for very large collections or frequent use, consider their paid plans.
  • Rate Limiting: While the script includes small delays between paged API requests and image downloads to be considerate to servers, aggressive use might still encounter rate limiting from Helius or the image hosting services.
  • Error Handling: The script includes error handling for common issues (network timeouts, HTTP errors, missing image URLs). If an image for a particular NFT cannot be fetched, it will be skipped, and an error message will be printed.
  • Disk Space: Ensure you have sufficient disk space, as NFT image collections can be large.

Disclaimer

This script is provided for educational and personal use. Always respect the terms of service of any APIs or websites you interact with. The developers are not responsible for any misuse or for any issues arising from its use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0