File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 13
13
from multiprocessing import Pool
14
14
from argparse import ArgumentParser
15
15
import logging
16
+ import json
16
17
17
18
import cloudscraper
18
19
import pandas as pd
@@ -109,7 +110,7 @@ def is_nft_suspicious(nft_url):
109
110
OPENSEA_BASE_URL = (
110
111
"https://opensea.io/assets/ethereum/" # TODO adjust for other blockchains
111
112
)
112
-
113
+ OPENSEA_BASE_API = "https://api.opensea.io/api/v1/asset/"
113
114
114
115
def list_collection_nfts_urls (collection_address ):
115
116
"""List all OpenSea URLs of NFTs in a collection
@@ -120,9 +121,15 @@ def list_collection_nfts_urls(collection_address):
120
121
Returns:
121
122
array: list of the OpenSea URLs of NFTs
122
123
"""
124
+ link = (OPENSEA_BASE_API + collection_address + "/0/?format=json" )
125
+ res = scraper .get (link )
126
+ parsed = json .loads (res .text )
127
+ nft_supply = int (parsed ['collection' ]['stats' ]['total_supply' ])
128
+
129
+
123
130
# ! This is just a mock function. It is to be replaced with a call to the OpenSea API
124
131
nft_urls = []
125
- for i in range (0 , 1000 ):
132
+ for i in range (0 , nft_supply ):
126
133
nft_urls .append (f"{ OPENSEA_BASE_URL } { collection_address } /{ i } " )
127
134
return nft_urls
128
135
You can’t perform that action at this time.
0 commit comments