try this:
Code:Public Function Search(ByVal Songname As String, ByVal mode As Integer) As Boolean 'TextBox1.Text = Songname Dim url As String = "" Dim reader As XDocument = Nothing If Songname = ("") Then Else Try If mode = 1 Then url = ("http://ws.spotify.com/search/1/track?q=" & (Songname)) ElseIf mode = 2 Then url = ("http://ws.spotify.com/search/1/artist?q=" & (Songname)) ElseIf mode = 3 Then url = ("http://ws.spotify.com/album/1/track?q=" & (Songname)) End If 'MsgBox(url) reader = XDocument.Load(url) 'MsgBox("Done") Catch ex As Exception Return False MsgBox(ex.ToString & (" DSAD")) End Try End If Dim ns As XNamespace = XNamespace.Get("http://www.spotify.com/ns/music/1") 'MsgBox(reader.Root.Elements(ns + "track").Count()) For Each track As XElement In reader.Root.Elements(ns + "track") Dim name As String = track.Element(ns + "name").Value Dim artistNode As XElement = track.Element(ns + "artist") Dim artistName As String = artistNode.Element(ns + "name").Value Dim albumNode As XElement = track.Element(ns + "album") Dim albumName As String = albumNode.Element(ns + "name").Value Dim released As String = albumNode.Element(ns + "released").Value ListView1.Items.Add(New ListViewItem(New String() {name, artistName, albumName, released})) Next End Function




Reply With Quote