Skip to content

Commit

Permalink
Extract fallback URL from attributes.share.html
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyMartynov committed Aug 30, 2024
1 parent d8f53e3 commit 994f03d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Tagging/ShazamApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ static void PopulateAttributes(JsonElement rootElement, ShazamResult result) {
if(String.IsNullOrEmpty(result.AppleSongID)) {
// As of March 2024
// shazam.com/track/[ID] redirects to shazam.com/song/[AppleSongID]
result.Url = result.Url.Replace("/track/", "/snippets/email-share/");
if(TryGetNestedProperty(attrsElement, ["share", "html"], out var shareHtmlElement)) {
result.Url = shareHtmlElement.GetString();
}
} else {
// Some URLs redirect to / unless the 'co' parameter is kept
// Examples: 11180294, 51774667, 538859473
Expand Down

0 comments on commit 994f03d

Please sign in to comment.