summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/helper
diff options
context:
space:
mode:
authorexislow <exislow@users.noreply.github.com>2025-09-07 18:27:52 +0200
committerGitHub <noreply@github.com>2025-09-07 18:27:52 +0200
commit40952ce13a9c9e787e0b3127b8d16bcb3cc406dd (patch)
tree9faec435eb0db7a8ae018ca886050c485eab3ed7 /tidal_dl_ng/helper
parent8939796164a40a21101cb6d22237c420385a19fc (diff)
parent541527be322a73e4ecdef215e04dc0a040250063 (diff)
downloadtidal-dl-ng-40952ce13a9c9e787e0b3127b8d16bcb3cc406dd.tar.gz
Merge pull request #528 from exislow:url-validator
Url-validator
Diffstat (limited to 'tidal_dl_ng/helper')
-rw-r--r--tidal_dl_ng/helper/tidal.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tidal_dl_ng/helper/tidal.py b/tidal_dl_ng/helper/tidal.py
index 3896fa6..96348f2 100644
--- a/tidal_dl_ng/helper/tidal.py
+++ b/tidal_dl_ng/helper/tidal.py
@@ -41,6 +41,7 @@ def name_builder_item(media: Track | Video) -> str:
def get_tidal_media_id(url_or_id_media: str) -> str:
+
id_dirty = url_or_id_media.rsplit("/", 1)[-1]
id_media = id_dirty.rsplit("?", 1)[0]
@@ -70,6 +71,18 @@ def get_tidal_media_type(url_media: str) -> MediaType | bool:
return result
+def url_ending_clean(url: str) -> str:
+ """Checks if a link ends with "/u" or "?u" and removes that part.
+
+ Args:
+ url (str): The URL to clean.
+
+ Returns:
+ str: The cleaned URL.
+ """
+ return url[:-2] if url.endswith("/u") or url.endswith("?u") else url
+
+
def search_results_all(session: Session, needle: str, types_media: SearchTypes = None) -> dict[str, [SearchTypes]]:
limit: int = 300
offset: int = 0