Skip to content

Commit

Permalink
edit locations
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePeeps191 committed Mar 8, 2024
1 parent 19b7057 commit 5c6529a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
File renamed without changes.
5 changes: 4 additions & 1 deletion cards/download_images.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
setid =
import json

setid = "base1"

33 changes: 0 additions & 33 deletions download_images.py
Original file line number Diff line number Diff line change
@@ -1,33 +0,0 @@
import requests
import urllib.request
import os
import json

opener = urllib.request.build_opener()
opener.addheaders = [('User-Agent', 'MyApp/1.0')]
urllib.request.install_opener(opener)

new_sets = []

s = requests.get("https://thepeeps191.github.io/api/sets.json").json()
for i in s:
y = i
y["id"] = y["id"].replace("pt", "")
l = y["legalities"]
y["legalities"] = []
for ll in l:
y["legalities"].append(ll)
del y["updatedAt"]
os.mkdir(y["id"])
urllib.request.urlretrieve(y["images"]["symbol"], y["images"]["symbol"].replace("https://images.pokemontcg.io/", "").replace("pt", ""))
urllib.request.urlretrieve(y["images"]["logo"], y["images"]["logo"].replace("https://images.pokemontcg.io/", "").replace("pt", ""))
y["images"]["symbol"] = y["images"]["symbol"].replace("images.pokemontcg.io/", "thepeeps191.github.io/api/").replace("pt", "")
y["images"]["logo"] = y["images"]["logo"].replace("images.pokemontcg.io/", "thepeeps191.github.io/api/").replace("pt", "")
new_sets.append(y)
print("Done:", y["id"])

with open("new_sets.json", "w") as f:
try:
json.dump(new_sets, f, indent = 4)
except Exception:
json.dump(new_sets, f)
33 changes: 33 additions & 0 deletions download_set_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import requests
import urllib.request
import os
import json

opener = urllib.request.build_opener()
opener.addheaders = [('User-Agent', 'MyApp/1.0')]
urllib.request.install_opener(opener)

new_sets = []

s = requests.get("https://thepeeps191.github.io/api/sets.json").json()
for i in s:
y = i
y["id"] = y["id"].replace("pt", "")
l = y["legalities"]
y["legalities"] = []
for ll in l:
y["legalities"].append(ll)
del y["updatedAt"]
os.mkdir(y["id"])
urllib.request.urlretrieve(y["images"]["symbol"], y["images"]["symbol"].replace("https://images.pokemontcg.io/", "").replace("pt", ""))
urllib.request.urlretrieve(y["images"]["logo"], y["images"]["logo"].replace("https://images.pokemontcg.io/", "").replace("pt", ""))
y["images"]["symbol"] = y["images"]["symbol"].replace("images.pokemontcg.io/", "thepeeps191.github.io/api/").replace("pt", "")
y["images"]["logo"] = y["images"]["logo"].replace("images.pokemontcg.io/", "thepeeps191.github.io/api/").replace("pt", "")
new_sets.append(y)
print("Done:", y["id"])

with open("new_sets.json", "w") as f:
try:
json.dump(new_sets, f, indent = 4)
except Exception:
json.dump(new_sets, f)

0 comments on commit 5c6529a

Please sign in to comment.