
Sub DownloadVideo(ByVal videoLink As String)
Dim I as new System.net.webclient
Dim x As String = I.DownloadString(videoLink)
Dim first As String = "delete yt.preload.videoConnection"
Dim second As String = "img = null"
Dim f1 As Integer = x.IndexOf(first) + first.Length + 1
Dim f2 As Integer = x.IndexOf(second, f1) + 1
Dim final As String = Mid(x, f1, f2 - f1)
Dim q1 As Integer = final.IndexOf("};") + 3
Dim q2 As Integer = final.IndexOf(";", q1) + 1
Dim final2 As String = Mid(final, q1, q2 - q1)
final2 = final2.Replace("img.src = ", "")
final2 = final2.Replace("'", "")
final2 = final2.Replace("http:\/\/", "http://")
final2 = final2.Replace("\/", "/")
final2 = final2.Replace("generate_204", "videoplayback")
final2 = final2.Trim
Dim ff As New SaveFileDialog
ff.Filter = "FLV FILE (*.flv)|*.flv"
If Not ff.ShowDialog = Windows.Forms.DialogResult.Cancel Then
My.Computer.Network.DownloadFile(final2, ff.FileName, "", "", True, 100000, True)
End If
End Sub
DownloadVideo("http://www.youtube.com/watch?v=-oCCnxBos10")