Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.Net] YouTube Video Downloader
#1

YouTube video Downloader - Fixed


Hello everyone. This is just simple example of YouTube Downloader, coded in Visual Basic .NET aka. Visual Basic 2008. Enjoy Cool

What we need:
RichTextBox1 - Name: rtb
RichTextBox2 - Name: txturl
WebBrowser1
Proggressbar1
TextBox1
Button1 (Text: Validate)
Button2 (Text: Download)
Button3 (Text: Cancel)

Screnshot:
[Image: 23kqfee.jpg]


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
Reply


Messages In This Thread
[VB.Net] YouTube Video Downloader - by BlackSpider - 04-06-2010, 03:43 AM
RE: [VB.Net] YouTube Video Downloader - by Cida - 04-07-2010, 03:41 AM
RE: [VB.Net] YouTube Video Downloader - by Teh - 04-08-2010, 05:42 AM
RE: [VB.Net] YouTube Video Downloader - by Kewlz - 04-08-2010, 07:33 AM
RE: [VB.Net] YouTube Video Downloader - by Aero - 04-11-2010, 11:06 AM
RE: [VB.Net] YouTube Video Downloader - by Xypher - 04-11-2010, 11:56 AM
RE: [VB.Net] YouTube Video Downloader - by cm31 - 04-15-2010, 07:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [VB.Net][SRC] YouTube Bot HF~Legend 5 3,667 11-25-2012, 05:54 AM
Last Post: Ixam
  [Preview/] YouTube Downloader and Converter full FFMPEG, Massive conversion list 2012 FizzyMentos 3 2,105 02-04-2012, 02:35 PM
Last Post: Denny Crane
  [TUT]$hareCash Downloader[NEW] Prominent 41 13,025 10-11-2011, 04:27 PM
Last Post: Genuine
  Help Coding A Downloader? Fragma 9 3,436 08-25-2011, 06:10 PM
Last Post: LiveModz
  [VB] File Downloader With ProgressBar[VB] Coding Support 16 8,532 07-30-2011, 09:13 AM
Last Post: Trustable

Forum Jump:


Users browsing this thread: 1 Guest(s)