Skip to content

Commit

Permalink
Fix None Download (#66)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Emersont1 authored Jan 29, 2023
1 parent faf9428 commit c652516
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions itchiodl/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,30 @@ def load_game(self, publisher, title):
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"""
Expand Down

0 comments on commit c652516

Please sign in to comment.