mirror of
https://github.com/DragoonAethis/itch-dl.git
synced 2024-12-20 18:11:52 +01:00
Don't crash when trying to download restricted title pages
While we currently can't handle them properly, this at least lets full library downloads proceed to the end.
This commit is contained in:
parent
2a18cea131
commit
e6b4428e22
@ -6,7 +6,7 @@ import urllib.parse
|
||||
from typing import List, Dict, TypedDict, Optional, Union
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from requests.exceptions import HTTPError
|
||||
from requests.exceptions import HTTPError, JSONDecodeError
|
||||
|
||||
from tqdm import tqdm
|
||||
from tqdm.contrib.concurrent import thread_map
|
||||
@ -114,8 +114,17 @@ class GameDownloader:
|
||||
data_request = self.client.get(data_url, append_api_key=False)
|
||||
if data_request.ok:
|
||||
try:
|
||||
game_id = int(data_request.json().get("id"))
|
||||
except ValueError:
|
||||
game_data = data_request.json()
|
||||
|
||||
if "errors" in game_data:
|
||||
raise ItchDownloadError(
|
||||
f"Game data fetching failed for {url} "
|
||||
f"(likely access restricted, see issue #16): {game_data['errors']}"
|
||||
)
|
||||
|
||||
if "id" in game_data:
|
||||
game_id = int(game_data["id"])
|
||||
except (ValueError, TypeError, JSONDecodeError):
|
||||
pass
|
||||
|
||||
if game_id is None:
|
||||
|
Loading…
Reference in New Issue
Block a user