mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 15:06:26 +00:00
GetAlbumArtUrl() fix
Fixed GetAlbumArtUrl
This commit is contained in:
parent
ca4bd1edaf
commit
e3700394f3
12
SpotifyAPI/Local/Models/Track.cs
Normal file → Executable file
12
SpotifyAPI/Local/Models/Track.cs
Normal file → Executable file
@ -70,12 +70,20 @@ namespace SpotifyAPI.Local.Models
|
|||||||
raw = wc.DownloadString("http://open.spotify.com/album/" + AlbumResource.Uri.Split(new[] { ":" }, StringSplitOptions.None)[2]);
|
raw = wc.DownloadString("http://open.spotify.com/album/" + AlbumResource.Uri.Split(new[] { ":" }, StringSplitOptions.None)[2]);
|
||||||
}
|
}
|
||||||
raw = raw.Replace("\t", "");
|
raw = raw.Replace("\t", "");
|
||||||
|
|
||||||
|
// < meta property = "og:image" content = "http://o.scdn.co/cover/12b318ffe0e4c92f9b4e1486e4726a57e6437ca7" >
|
||||||
|
// Spotify changed the response so I am now getting the substring from the first line that parses out the above tag.
|
||||||
string[] lines = raw.Split(new[] { "\n" }, StringSplitOptions.None);
|
string[] lines = raw.Split(new[] { "\n" }, StringSplitOptions.None);
|
||||||
|
string startString = "<meta property=\"og:image\"";
|
||||||
|
string endString = "\">";
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
if (line.Trim().StartsWith("<meta property=\"og:image\""))
|
if (line.Trim().Contains("<meta property=\"og:image\""))
|
||||||
{
|
{
|
||||||
string[] l = line.Split(new[] { "/" }, StringSplitOptions.None);
|
int start = line.IndexOf(startString, 0) + startString.Length;
|
||||||
|
int end = line.IndexOf(endString, start);
|
||||||
|
string content = line.Substring(start, end - start);
|
||||||
|
string[] l = content.Split(new[] { "/" }, StringSplitOptions.None);
|
||||||
return "http://o.scdn.co/" + albumsize + @"/" + l[4].Replace("\"", "").Replace(">", "");
|
return "http://o.scdn.co/" + albumsize + @"/" + l[4].Replace("\"", "").Replace(">", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user