diff --git a/src/music_kraken/connection/connection.py b/src/music_kraken/connection/connection.py index 8c1a1e2..d5e1a28 100644 --- a/src/music_kraken/connection/connection.py +++ b/src/music_kraken/connection/connection.py @@ -81,6 +81,7 @@ class Connection: timeout: float, headers: dict, refer_from_origin: bool = True, + raw_url: bool = False, **kwargs ) -> Optional[requests.Response]: if try_count >= self.TRIES: @@ -100,19 +101,21 @@ class Connection: url=parsed_url ) + request_url = parsed_url.geturl() if not raw_url else url + retry = False try: - r: requests.Response = request(url=parsed_url.geturl(), timeout=timeout, headers=headers, **kwargs) + r: requests.Response = request(url=request_url, timeout=timeout, headers=headers, **kwargs) except requests.exceptions.Timeout: - self.LOGGER.warning(f"Request timed out at \"{url}\": ({try_count}-{self.TRIES})") + self.LOGGER.warning(f"Request timed out at \"{request_url}\": ({try_count}-{self.TRIES})") retry = True except requests.exceptions.ConnectionError: - self.LOGGER.warning(f"Couldn't connect to \"{url}\": ({try_count}-{self.TRIES})") + self.LOGGER.warning(f"Couldn't connect to \"{request_url}\": ({try_count}-{self.TRIES})") retry = True if not retry: if self.SEMANTIC_NOT_FOUND and r.status_code == 404: - self.LOGGER.warning(f"Couldn't find url (404): {url}") + self.LOGGER.warning(f"Couldn't find url (404): {request_url}") print(r.headers) print(r.request.headers) return @@ -144,6 +147,7 @@ class Connection: accepted_response_codes: set = None, timeout: float = None, headers: dict = None, + raw_url: bool = False, **kwargs ) -> Optional[requests.Response]: r = self._request( @@ -155,6 +159,7 @@ class Connection: timeout=timeout, headers=headers, refer_from_origin=refer_from_origin, + raw_url=raw_url, **kwargs ) if r is None: @@ -170,6 +175,7 @@ class Connection: accepted_response_codes: set = None, timeout: float = None, headers: dict = None, + raw_url: bool = False, **kwargs ) -> Optional[requests.Response]: r = self._request( @@ -182,6 +188,7 @@ class Connection: refer_from_origin=refer_from_origin, json=json, stream=stream, + raw_url=raw_url, **kwargs ) if r is None: diff --git a/src/music_kraken/pages/musify.py b/src/music_kraken/pages/musify.py index 48de5f5..d73e3b9 100644 --- a/src/music_kraken/pages/musify.py +++ b/src/music_kraken/pages/musify.py @@ -1039,7 +1039,7 @@ class Musify(Page): cls.LOGGER.warning(f"The source has no audio link. Falling back to {endpoint}.") - r = cls.CONNECTION.get(endpoint, stream=True, allow_redirects=True, headers={"Connection": "https://musify.club/"}) + r = cls.CONNECTION.get(endpoint, stream=True, allow_redirects=True, headers={"Connection": "https://musify.club/"}, raw_url=True) if r is None: return DownloadResult(error_message=f"couldn't connect to {endpoint}")