Skip to content

Commit

Permalink
Fix status 401 not catching secrets (#766)
Browse files Browse the repository at this point in the history
* fix status 401 not catching secrets

* remove unnecessary method

---------

Co-authored-by: adamarous <[email protected]>
  • Loading branch information
dybucc and adamarous authored Dec 7, 2024
1 parent 46b570d commit 1aad9f0
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions streamrip/client/qobuz.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,25 +382,10 @@ async def _get_app_id_and_secrets(self) -> tuple[str, list[str]]:
return await spoofer.get_app_id_and_secrets()

async def _get_valid_secret(self, secrets: list[str]) -> str:
results = await asyncio.gather(
*[self._test_secret(secret) for secret in secrets],
)
working_secrets = [r for r in results if r is not None]

if len(working_secrets) == 0:
raise InvalidAppSecretError(secrets)
working_secrets = [r for r in secrets]

return working_secrets[0]

async def _test_secret(self, secret: str) -> Optional[str]:
status, _ = await self._request_file_url("19512574", 4, secret)
if status == 400:
return None
if status == 200:
return secret
logger.warning("Got status %d when testing secret", status)
return None

async def _request_file_url(
self,
track_id: str,
Expand Down

0 comments on commit 1aad9f0

Please sign in to comment.