File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,20 @@ public string GetAlbumArtUrl(AlbumArtSize size)
70
70
raw = wc . DownloadString ( "http://open.spotify.com/album/" + AlbumResource . Uri . Split ( new [ ] { ":" } , StringSplitOptions . None ) [ 2 ] ) ;
71
71
}
72
72
raw = raw . Replace ( "\t " , "" ) ;
73
+
74
+ // < meta property = "og:image" content = "http://o.scdn.co/cover/12b318ffe0e4c92f9b4e1486e4726a57e6437ca7" >
75
+ // Spotify changed the response so I am now getting the substring from the first line that parses out the above tag.
73
76
string [ ] lines = raw . Split ( new [ ] { "\n " } , StringSplitOptions . None ) ;
77
+ string startString = "<meta property=\" og:image\" " ;
78
+ string endString = "\" >" ;
74
79
foreach ( string line in lines )
75
80
{
76
- if ( line . Trim ( ) . StartsWith ( "<meta property=\" og:image\" " ) )
81
+ if ( line . Trim ( ) . Contains ( "<meta property=\" og:image\" " ) )
77
82
{
78
- string [ ] l = line . Split ( new [ ] { "/" } , StringSplitOptions . None ) ;
83
+ int start = line . IndexOf ( startString , 0 ) + startString . Length ;
84
+ int end = line . IndexOf ( endString , start ) ;
85
+ string content = line . Substring ( start , end - start ) ;
86
+ string [ ] l = content . Split ( new [ ] { "/" } , StringSplitOptions . None ) ;
79
87
return "http://o.scdn.co/" + albumsize + @"/" + l [ 4 ] . Replace ( "\" " , "" ) . Replace ( ">" , "" ) ;
80
88
}
81
89
}
You can’t perform that action at this time.
0 commit comments