[VB.Net] YouTube Video Downloader - BlackSpider - 04-06-2010
YouTube video Downloader - Fixed
Hello everyone. This is just simple example of YouTube Downloader, coded in Visual Basic .NET aka. Visual Basic 2008. Enjoy
What we need:
RichTextBox1 - Name: rtb
RichTextBox2 - Name: txturl
WebBrowser1
Proggressbar1
TextBox1
Button1 (Text: Validate)
Button2 (Text: Download)
Button3 (Text: Cancel)
Screnshot:
Source Codes:
Code: 'Coded by Soul Collector + Resource :)
Imports System.Net
Public Class frmMain
Private WithEvents download As WebClient
Private Sub TheLink()
Dim i As Integer
Dim l As Integer
Dim string1 As String
i = rtb.Find("watch_fullscreen")
l = rtb.Find("&title")
rtb.Select(i, rtb.Text.Length)
txturl.Text = rtb.SelectedText.ToString
rtb.Select(l, rtb.Text.Length)
string1 = rtb.SelectedText.ToString
txturl.Text = txturl.Text.Replace(string1, "&")
txturl.Text = txturl.Text.Insert(0, "http://www.youtube.com/get_video?")
End Sub
Private Sub done()
lblDld.Text = "Downloaded: 0 Bytes"
lblTitle.Text = "Video Title: "
lblProgress.Text = "0%"
ProgressBar1.Value = 0
End Sub
Private Sub download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
lblProgress.Text = e.ProgressPercentage & " %"
lblDld.Text = e.BytesReceived & "Downloaded: " & e.TotalBytesToReceive & " Bytes"
done()
MsgBox("The video is downloaded.", MsgBoxStyle.Information, "")
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
If WebBrowser1.Url.ToString.Contains("http://www.youtube.com/") Then
lblTitle.Text = "Video Title: " & WebBrowser1.DocumentTitle
lblTitle.Text = lblTitle.Text.Replace("YouTube - ", "")
rtb.Text = WebBrowser1.DocumentText
WebBrowser1.Navigate("about:blank")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If MessageBox.Show("Do you really want to quit progress?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
End
Else
Exit Sub
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Not txturl.Text = "" Then
If txturl.Text.Contains("http://www.youtube.com/watch?v") Then
WebBrowser1.Navigate(TextBox1.Text)
Else
MsgBox("Please type in valid YouTube URL.", MsgBoxStyle.Exclamation, "")
Exit Sub
End If
Else
MsgBox("Please type in valid YouTube URL.", MsgBoxStyle.Exclamation, "")
Exit Sub
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txturl.Text.Contains("youtube.com") = False Then
MsgBox("Please type in valid YouTube URL.", MsgBoxStyle.Exclamation, "")
Exit Sub
End If
TheLink()
Dim sdlg As New SaveFileDialog
sdlg.Filter = "Flv Files |*.flv"
sdlg.FileName = lblTitle.Text & ".flv"
sdlg.ShowDialog()
download = New WebClient
Dim link = txturl.Text
Dim SavePath = sdlg.FileName
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
Try
download.DownloadFileAsync(New Uri(link), (SavePath))
Catch ex As Exception
MsgBox("Cannot download the video, please check your URL.", MsgBoxStyle.Exclamation, "")
Exit Sub
End Try
End Sub
End Class
Download Source:
http://www.multiupload.com/S4S3V9W7CK
RE: [VB.Net] YouTube Video Downloader - Navineous - 04-06-2010
thanks for the source code, shall give this a go, looks great to use
RE: [VB.Net] YouTube Video Downloader - GameOver* - 04-07-2010
i had another program YouTube Downloader but this is nice too! mile:
RE: [VB.Net] YouTube Video Downloader - BrainDeadFreak - 04-07-2010
Thanks for the source. It will come in handy.
RE: [VB.Net] YouTube Video Downloader - TheBlackMarket - 04-07-2010
Very nice! Alot of people have been searching for like this program for long time. If someone wants to download a song from youtube. I Will recommend http://www.video2mp3.net/index.php its a very nice site that is downloading the video and converting the video into a mp3 file
RE: [VB.Net] YouTube Video Downloader - Cida - 04-07-2010
Thanks for the source, I'll try an built it later, I like this one cause it has a progress bar, an I'll be able to customize it.
RE: [VB.Net] YouTube Video Downloader - Notieboie - 04-07-2010
Thanks for the source code sc.
RE: [VB.Net] YouTube Video Downloader - Teh - 04-08-2010
Hmm , tried it it doesn't work for me.. Maybe i did something wrong..?
RE: [VB.Net] YouTube Video Downloader - Kewlz - 04-08-2010
thanks For Sharing
RE: [VB.Net] YouTube Video Downloader - MyFolder - 04-08-2010
Thank's for sharing the source mate..
|