Guest User

Untitled

a guest
Jan 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Private Function getPlid()
  2.  
  3. If Not String.IsNullOrEmpty(_plid) Then
  4. Return _plid
  5. End If
  6. Dim the_request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www.youtube.com/watch?v=dCsr0CNqB3g")
  7. Dim the_response As System.Net.HttpWebResponse = the_request.GetResponse
  8. Dim stream_reader As System.IO.StreamReader = New System.IO.StreamReader(the_response.GetResponseStream())
  9.  
  10. Dim yt_source As String = stream_reader.ReadToEnd
  11.  
  12. If String.IsNullOrEmpty(yt_source) Then
  13. WriteToLog(ProcessId, "Youtube ID Request Error")
  14. Else
  15. Dim r As Regex = New Regex("""plid"":""(.{16})""")
  16. Dim m = r.Match(yt_source)
  17. If (m IsNot Nothing And m.Groups.Count > 1) Then
  18. _plid = m.Groups(1).Value.Substring(0, 4)
  19. Return _plid
  20. End If
  21. End If
  22. Return String.Empty
  23. End Function
Add Comment
Please, Sign In to add comment