Update soundcloud client id #164

This commit is contained in:
Nathan Thomas 2021-09-07 14:56:45 -07:00
parent e49df1e719
commit e103c978bb
4 changed files with 21 additions and 5 deletions

View file

@ -1221,7 +1221,14 @@ class SoundCloudClient(Client):
resp, _ = self._get(f"search/{media_type}s", params=params)
return resp
def _get(self, path, params=None, no_base=False) -> Tuple[dict, int]:
def _get(
self,
path,
params=None,
no_base=False,
skip_decode=False,
headers=None,
) -> Optional[Tuple[dict, int]]:
"""Send a request to the SoundCloud API.
:param path:
@ -1246,6 +1253,11 @@ class SoundCloudClient(Client):
url = f"{SOUNDCLOUD_BASE}/{path}"
logger.debug("Fetching url %s with params %s", url, params)
r = self.session.get(url, params=params)
r = self.session.get(url, params=params, headers=headers)
r.raise_for_status()
if skip_decode:
return None
return r.json(), r.status_code

View file

@ -7,9 +7,12 @@ AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firef
TIDAL_COVER_URL = (
"https://resources.tidal.com/images/{uuid}/{width}x{height}.jpg"
)
SOUNDCLOUD_CLIENT_ID = "QFciLWLC1GS4P3EZvXIjA3jKhKO5pKB3"
# Get this from (base64encoded)
# aHR0cHM6Ly9hLXYyLnNuZGNkbi5jb20vYXNzZXRzLzItYWIxYjg1NjguanM=
# Don't know if this is a static url yet
SOUNDCLOUD_CLIENT_ID = "qHsjZaNbdTcABbiIQnVfW07cEPGLNjIh"
SOUNDCLOUD_USER_ID = "672320-86895-162383-801513"
SOUNDCLOUD_APP_VERSION = "1626941202"
SOUNDCLOUD_APP_VERSION = "1630917744"
QUALITY_DESC = {

View file

@ -270,6 +270,7 @@ class TrackMetadata:
self.tracknumber = 0
self.tracktotal = 0
self.quality = 0
self.cover_urls = get_cover_urls(track, "soundcloud")
else:
raise ValueError(self.__source)

View file

@ -462,7 +462,7 @@ def get_container(quality: int, source: str) -> str:
return "MP3"
def get_cover_urls(resp: dict, source: str, is_track: bool = True) -> dict:
def get_cover_urls(resp: dict, source: str) -> dict:
"""Parse a response dict containing cover info according to the source.
:param resp: