Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions streamrip/rip/parse_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ async def into_pending(
class GenericURL(URL):
@classmethod
def from_str(cls, url: str) -> URL | None:
# tidal.com/track/123/u messes with the regex
if "tidal.com" in url and url.endswith("/u"):
url = url.rstrip("/u")

generic_url = URL_REGEX.match(url)
if generic_url is None:
return None
Expand Down
12 changes: 12 additions & 0 deletions tests/test_parse_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ def test_tidal_track_url(self):
self.assertEqual(groups[1], "track") # media_type
self.assertEqual(groups[2], "3083287") # item_id

_test = lambda u: parse_url(u).match.groups()

self.assertEqual(
_test("https://tidal.com/track/144921990/u"),
("tidal", "track", "144921990"),
)

self.assertEqual(
_test("https://tidal.com/track/454879903?u"),
("tidal", "track", "454879903"),
)

def test_deezer_track_url(self):
"""Test that Deezer track URLs are matched correctly."""
url = "https://www.deezer.com/track/4195713"
Expand Down