Fix None Download (#66)

Fixes: #57 #59 #63

This is a really sub-par fix to the problem for downloading a singular game that you own
+ Owned games need a download key
+ I can only find this via owned-keys
+ It requires searching through (up to) all of your owned keys
This commit is contained in:
Peter Taylor 2023-01-29 19:32:11 +00:00 committed by GitHub
parent faf9428e23
commit c652516eec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,11 +48,30 @@ class Library:
j = json.loads(rsp.text)
game_id = j["id"]
gsp = requests.get(
f"https://api.itch.io/games/{game_id}",
f"https://api.itch.io/games/{game_id}/uploads",
headers={"Authorization": self.login},
)
k = json.loads(gsp.text)
self.games.append(Game(k))
k = gsp.json()
if k != {"uploads": {}}:
self.games.append(Game(k))
return
print(f"{title} is a purchased game.")
i = 1
while self.games == []:
j = self.load_game_page(i)
self.games = [
x
for x in self.games
if x.link == f"https://{publisher}.itch.io/{title}"
]
if j == 0:
break
i += 1
if self.games == []:
print(f"Cannot find {title} in owned keys, you may not own it.")
def load_games(self, publisher):
"""Load all games by publisher"""