Generate Youtube Video URL
Use this board to post your code snippets - tips and tricks
8 posts
Page 1 of 1
try this guys
Code: Select all
#Region "Generate You-Tube URL"
Public Sub MakeDownloadURL(ByVal url As String, ByRef output As String, Optional ByRef type As String = "", Optional ByRef size As Integer = 0)
'PERFORMS CLEANUP
downloadurl = ""
If request IsNot Nothing Then
Try
request.Abort()
Catch
End Try
End If
If response IsNot Nothing Then
Try
response.Close()
Catch
End Try
End If
Try
source = ""
Catch
End Try
request = DirectCast(HttpWebRequest.Create(url.ToString), HttpWebRequest)
Try
response = DirectCast(request.GetResponse, HttpWebResponse)
Catch
type = ""
Exit Sub
End Try
source = New StreamReader(response.GetResponseStream, System.Text.Encoding.Default).ReadToEnd
If source.IndexOf("video_id") > -1 Then
'This grabs the .flv location URL ready for doownloading.
Dim signature As String = source
If signature.Contains("&fmt_url_map=") = True Then
Try
signature = System.Text.RegularExpressions.Regex.Split(signature, "&fmt_url_map=")(1)
Catch
End Try
ElseIf signature.Contains(Chr(34) + "fmt_url_map" + Chr(34) + ": " + Chr(34)) = True Then
Try
signature = System.Text.RegularExpressions.Regex.Split(signature, Chr(34) + "fmt_url_map" + Chr(34) + ": " + Chr(34))(1)
Catch
End Try
Else
Debug.WriteLine("Critical Error: Download URL could not be produced.")
type = ""
Exit Sub
End If
'This changes the URL to conform to internet standards eg. %20 = " "
signature = signature.Remove(0, 5)
signature = signature.Replace("%252C", ",")
signature = signature.Replace("%2F", "/")
signature = signature.Replace("%3D", "=")
signature = signature.Replace("%3F", "?")
signature = signature.Replace("%3A", ":")
signature = signature.Replace("%26", "&")
Dim sig2 As String = signature
sig2 = sig2.IndexOf("http", 30)
signature = signature.Remove(sig2, signature.Length - sig2)
signature = signature.Remove(signature.IndexOf("%"), 7)
'Removes any remaining % characters from the string.
signature = signature.Replace("%", "")
'Checks for and fixes any malformed http requests in the string.
If signature.StartsWith("ttp://") Then
signature = signature.Replace("ttp://", "http://")
End If
'Checks for and Removes any remaining C characters from the string.
If signature.Chars(signature.Length - 1) = "C" Then
signature = signature.Remove(signature.Length - 1, 1)
End If
'Checks for videos such as http://www.youtube.com/watch?v=LvLCvdeWcsw that would not download due to a new layout of download data.
If signature.Contains("rv.2.rating") Then
Dim n As Integer = signature.IndexOf(ChrW(34) + ",")
signature = signature.Remove(n, signature.Length - n)
End If
'PERFORMS CLEANUP
If request2 IsNot Nothing Then
Try
request2.Abort()
Catch
End Try
End If
If response2 IsNot Nothing Then
Try
response2.Close()
Catch
End Try
End If
Try
request2 = DirectCast(HttpWebRequest.Create(signature), HttpWebRequest)
Catch
type = ""
Exit Sub
End Try
response2 = DirectCast(request2.GetResponse, HttpWebResponse)
If response2.ContentType = "video/x-flv" Then
type = ".flv"
output = signature
size = response2.ContentLength
ElseIf response2.ContentType = "video/mp4" Then
type = ".mp4"
output = signature
size = response2.ContentLength
Else
type = ""
output = ""
Exit Sub
End If
End If
End Sub
#End Region
Find my programs on Softpedia
This Generates download url, also its stealed, i saw the same code somewhere else.
hey you are annoying me !
dont you know whats stealing ? stealing is getting something without owners permission . did you got it ? . and this is the best way to generate youtube video url .
dont you know whats stealing ? stealing is getting something without owners permission . did you got it ? . and this is the best way to generate youtube video url .
Find my programs on Softpedia
STOP SAYING BLABLABLA ITS SPAM AND ANNOYING NOW STOP!
Starting my life over due to a recent tornado that struck March 23, 2012 hit couple houeses couple stores luckly not my house and my internet still works!
what u mean ?? . blablabla . hey you are spaming here ' caps on ' . capital letters
Find my programs on Softpedia
And you just double-posted, as well as just proved you don't know the definition of stealing.
Posting code and claiming it as yours is as much stealing as taking your book and never returning it would be.
Posting code and claiming it as yours is as much stealing as taking your book and never returning it would be.
mshimranpro & Coal that kind of childish input is not needed here and this is stolen code so there is no point in this here.
8 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023