stealNFTs | Bash

November 23rd, 2021 01:45:40 AM

					
#!/bin/bash #Makes a directory ./monkeys and puts every single bored bored ape yacht club monkey in there #Leif Messinger let OFFSET=0 let BATCHSIZE=50 let LIMIT=100 mkdir monkeys function parseResults(){ sed 'y/,/\n/' | sed -e '/storage.opensea/d' -e '/https:\/\/lh3.googleusercontent.com\/Ju9CkWtV-1Okvf45wo8UctR-M9He2PjILP0oOvxE89AyiPPGtrR3gysu1Zgy0hjd2xKIgjJJtWIc0ybj4Vd7wv8t3pxDGHoJBzDB=s120/d' | egrep '"image_url":"(.*)"' | tr -d '\"' | sed 's/image_url://' } function downloadMonkeys(){ while read -r line; do name=`echo "$line" | sed 's/https:\/\/lh3.googleusercontent.com\///'` wget -q -O "./monkeys/$name.png" "$line" & done } function queryMonkeys(){ let progress=($OFFSET*100)/$LIMIT echo "Progress: $progress%" result=`curl -s --request GET --url "https://api.opensea.io/api/v1/assets?order_direction=desc&offset=$OFFSET&limit=$BATCHSIZE&collection=boredapeyachtclub"` if [[ "$result" =~ "Request was throttled" ]] || [ "$result" == "" ]; then #Retry download sleep 10 else #Download Monkeys echo "$result" | parseResults | downloadMonkeys let OFFSET+=$BATCHSIZE fi #If not out of bounds, recurse if [ "$OFFSET" -lt "$LIMIT" ] || [[ "$result" =~ '"assets":[]' ]]; then queryMonkeys fi } echo "Downloading your monkeys into ./monkeys asynchronously." queryMonkeys

Featured Posts