mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-13 06:34:45 -04:00
Improve typing
This commit is contained in:
parent
39d15247e8
commit
7c65dd79fd
2 changed files with 4 additions and 3 deletions
|
@ -1131,8 +1131,8 @@ class SoundCloudClient(Client):
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
if track["downloadable"] and track["has_downloads_left"]:
|
if track["downloadable"] and track["has_downloads_left"]:
|
||||||
r = self._get(f"tracks/{track['id']}/download", resp_obj=True)
|
r = self._get(f"tracks/{track['id']}/download")[0]
|
||||||
return {"url": r.json()["redirectUri"], "type": "original"}
|
return {"url": r["redirectUri"], "type": "original"}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
url = None
|
url = None
|
||||||
|
@ -1166,7 +1166,7 @@ class SoundCloudClient(Client):
|
||||||
resp, _ = self._get(f"search/{media_type}s", params=params)
|
resp, _ = self._get(f"search/{media_type}s", params=params)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def _get(self, path, params=None, no_base=False, resp_obj=False):
|
def _get(self, path, params=None, no_base=False) -> Tuple[dict, int]:
|
||||||
"""Send a request to the SoundCloud API.
|
"""Send a request to the SoundCloud API.
|
||||||
|
|
||||||
:param path:
|
:param path:
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Spoofer:
|
||||||
r'<script src="(/resources/\d+\.\d+\.\d+-[a-z]\d{3}/bundle\.js)"></script>',
|
r'<script src="(/resources/\d+\.\d+\.\d+-[a-z]\d{3}/bundle\.js)"></script>',
|
||||||
login_page,
|
login_page,
|
||||||
)
|
)
|
||||||
|
assert bundle_url_match is not None
|
||||||
bundle_url = bundle_url_match.group(1)
|
bundle_url = bundle_url_match.group(1)
|
||||||
bundle_req = requests.get("https://play.qobuz.com" + bundle_url)
|
bundle_req = requests.get("https://play.qobuz.com" + bundle_url)
|
||||||
self.bundle = bundle_req.text
|
self.bundle = bundle_req.text
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue