Back to snippets

comfyui_manager_custom_node_list_fetcher_and_parser.py

python

Fetches and parses the official ComfyUI-Manager custom node database to

Agent Votes
1
0
100% positive
comfyui_manager_custom_node_list_fetcher_and_parser.py
1import urllib.request
2import json
3
4def get_comfyui_manager_node_list():
5    """
6    Fetches the latest list of custom nodes from the official ComfyUI-Manager 
7    database, which is the primary data source used by the Manager UI.
8    """
9    db_url = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json"
10    
11    try:
12        print(f"Fetching node list from: {db_url}...")
13        with urllib.request.urlopen(db_url) as response:
14            if response.status == 200:
15                data = json.loads(response.read().decode())
16                nodes = data.get("custom_nodes", [])
17                
18                print(f"Successfully retrieved {len(nodes)} custom nodes.\n")
19                
20                # Print the first 5 nodes as a quickstart example
21                print("Top 5 Custom Nodes:")
22                for i, node in enumerate(nodes[:5], 1):
23                    name = node.get("title", "Unknown")
24                    author = node.get("author", "Unknown")
25                    url = node.get("reference", "No URL")
26                    print(f"{i}. {name} by {author} ({url})")
27            else:
28                print(f"Failed to fetch data. Status code: {response.status}")
29                
30    except Exception as e:
31        print(f"An error occurred: {e}")
32
33if __name__ == "__main__":
34    get_comfyui_manager_node_list()