OpenSea-NFT-Stealer icon indicating copy to clipboard operation
OpenSea-NFT-Stealer copied to clipboard

Only downloads the first 22 NFTs

Open FunnyGuyM123 opened this issue 3 years ago • 6 comments

Only downloads the first 22 NFTs in the Bored Ape Yacht Club collection

FunnyGuyM123 avatar Jan 14 '22 14:01 FunnyGuyM123

not every nft has image_original_url in the json so that makes it stop.

Probably not a clean way but this workaround worked for me: I replaced this part of code:

        # Make the request to the URL to get the image
        if not asset["image_original_url"] == None:
          image = requests.get(asset["image_original_url"])
        else:
          image = requests.get(asset["image_url"])

with this one:

        # Make the request to the URL to get the image
        if not asset["image_url"] is None:
          image = requests.get(asset["image_url"])

With this change image could end up being undefined, but works goog enough to make a quick big nft heist.

NtekShadow avatar Jan 14 '22 19:01 NtekShadow

Same problem. The script was fine until yesterday, but now is failing all time

Salro1g avatar Jan 15 '22 10:01 Salro1g

Probably not a clean way but this workaround worked for me: I replaced this part of code:

        # Make the request to the URL to get the image
        if not asset["image_original_url"] == None:
          image = requests.get(asset["image_original_url"])
        else:
          image = requests.get(asset["image_url"])

with this one:

        # Make the request to the URL to get the image
        if not asset["image_url"] is None:
          image = requests.get(asset["image_url"])

With this change image could end up being undefined, but works goog enough to make a quick big nft heist.

Dude, you are GOD

Salro1g avatar Jan 15 '22 10:01 Salro1g

Hi,

By changing the script as NtekShadow commented ran well but the quality of pngs gone down. Not a problem at all.

But now, is impossible to achieve or run the script, all time says this:

Traceback (most recent call last): File "c:/Documents/GitHub/OpenSea-NFT-Stealer/opensea.py", line 60, in data = json.loads(requests.get(f"https://api.opensea.io/api/v1/assets?order_direction=asc&offset={offset}&limit=50&collection={CollectionName}&format=json").content.decode()) File "C:\Users\AppData\Local\Programs\Python\Python38\lib\json_init_.py", line 357, in loads return _default_decoder.decode(s) File "C:\Users\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

In windows and in MacOS

Salro1g avatar Jan 15 '22 21:01 Salro1g

@Salro1g 1: It only downloads the standart quality pictures after changing the code, since not all nft provide a Original quality link to get the pic and that stopped the original code from executing once it hit such a picture. like i said, its not a nice or the best solution

2: I get the same problem too now, my best guess is that they changed something with their api to prevent mass download of the nfts. Or it could be a temporary problem. i can get the json directly but not in the python program

from the OpenSea API Twitter: "[status] Investigation: Due to increased site load, programmatic acces to orders has been temporarily disabled."

officialy it has been resolved but yea started arround the time where they resolved it for me

https://status.opensea.io/

NtekShadow avatar Jan 15 '22 21:01 NtekShadow

@Salro1g Got it working again first define headers with a user client like this:

  headers = {
      'User-Agent': 'Put the userclient you want to use in here'
  }

you can find a userclient name on here: https://www.whatismybrowser.com/guides/the-latest-user-agent/

then change the request.get in the first for loop for data to include the headers:

data = json.loads(requests.get(
                f"https://api.opensea.io/api/v1/assets?order_direction=asc&offset={offset}"
                f"&limit=50&collection={CollectionName}&format=json", headers=headers).content.decode())

and it should work again.

NtekShadow avatar Jan 16 '22 11:01 NtekShadow