Guest User

Mp3Skip for VB.net

a guest
Jan 21st, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.57 KB | None | 0 0
  1. Public Module mp3skip
  2.     Private count As Integer
  3.     Public Function GetResult(ByVal query As String) As List(Of String)
  4.         On Error Resume Next
  5.         Dim wc As New Net.WebClient
  6.         Dim temp As String = wc.DownloadString("http://mp3skip.eu/mp3/" & LCase(query.Replace(" ", "_")) & ".html")
  7.         'Get Song Names
  8.         Dim songnames As New List(Of String)
  9.         For Each mc As System.Text.RegularExpressions.Match In System.Text.RegularExpressions.Regex.Matches(temp, "<b>.*</b>")
  10.             songnames.Add(mc.Value.Replace("<b>", Nothing).Replace("</b>", Nothing).Replace("&amp;", Nothing).Replace("&#39;", "'"))
  11.         Next
  12.         For i As Integer = 1 To 3
  13.             songnames.RemoveAt(songnames.Count - 1)
  14.             songnames.RemoveAt(songnames.Count - 1)
  15.             songnames.RemoveAt(songnames.Count - 1)
  16.         Next
  17.         'Get Mp3 Files
  18.         Dim mp3urls As New List(Of String)
  19.         For Each mc As System.Text.RegularExpressions.Match In System.Text.RegularExpressions.Regex.Matches(temp, "<a href=^.*^ rel=^nofollow^ target=^_blank^ style=^color:green;^>Download</a>".Replace("^", """"))
  20.             mp3urls.Add(GetBetween(mc.Value, "href=" & """", """", 0))
  21.         Next
  22.         Return mp3urls
  23.     End Function
  24.     Private Function GetBetween(ByVal input As String, ByVal str1 As String, ByVal str2 As String, ByVal index As Integer) As String
  25.         Dim temp As String = System.Text.RegularExpressions.Regex.Split(input, str1)(index + 1)
  26.         Return System.Text.RegularExpressions.Regex.Split(temp, str2)(0)
  27.     End Function
  28. End Module
Advertisement
Add Comment
Please, Sign In to add comment