Sign in to follow this  
Followers 0
redfenix

Get 4K link from youtube video

15 posts in this topic

How can i get, starting from a youtube link, a 4K (quality) link?

Thanks :)

Share this post


Link to post
Share on other sites



Hi,

What is the 4K quality?

There is some examples in the forum to get youtube links.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi,

What is the 4K quality?

There is some examples in the forum to get youtube links.

Br, FireFox.

 

For example: 

Share this post


Link to post
Share on other sites

Check my YouTube Multi-Downloader (link in my signature) and try with your video link, use the correct settings and you will be able to get the Original quality link.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Check my YouTube Multi-Downloader (link in my signature) and try with your video link, use the correct settings and you will be able to get the Original quality link.

Br, FireFox.

 

I would like to write a program for download only 4K video, not use your for download vid ;)

So can you explain me only this part of video download process? (generate 4k link)

Edited by redfenix

Share this post


Link to post
Share on other sites

The source code is available, take a look at it.

Between me and you, if there is already a program for it, why re-inventing the wheel?


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

To write it according to my taste :)

...

Sorry but i can't understood the correct method, in your sources there are too many variables and i can't follow all your mental path (?)

 

(sorry for my english :()

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I understand this is complex for you. I havn't looked at the code for months and it has to be updated since it's not working anymore with all links.

I'm sorry but according to what I said I won't be able to help you until I have updated this last.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Thanks you anyway ;)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

If you are still there, here you go :

;Author: FireFox @2013
#include <String.au3>
#include "WinHTTP.au3"
 
Local $sDownload_VideoID = "kIjjHeD-0dY"
 
Local Const $sHTTPUserAgent = "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0"
 
Local $hWinHttpOpen = _WinHttpOpen($sHTTPUserAgent)
Local $hWinHttpConnect = _WinHttpConnect($hWinHttpOpen, "www.youtube.com")
 
Local $hWinHttpRequest = _WinHttpOpenRequest($hWinHttpConnect, "GET", _
        "/watch?v=" & $sDownload_VideoID, _
        "HTTP/1.1")
 
_WinHttpSendRequest($hWinHttpRequest)
 
_WinHttpReceiveResponse($hWinHttpRequest)
 
Local $sDownload_Chunk = "", $sDownload_ResponseData = ""
While 1
    $sDownload_Chunk = _WinHttpReadData($hWinHttpRequest, 1)
    If @error Then ExitLoop
    $sDownload_ResponseData &= $sDownload_Chunk
WEnd
 
_WinHttpCloseHandle($hWinHttpRequest)
 
Local $aDownload_URLMap = _StringBetween($sDownload_ResponseData, '"url_encoded_fmt_stream_map": "', '", "')
 
If StringInStr($aDownload_URLMap[0], '"}};') > 0 Then
    $aDownload_URLMap[0] = StringLeft($aDownload_URLMap[0], StringInStr($aDownload_URLMap[0], '"}};'))
EndIf
 
$aDownload_URLMap = StringSplit($aDownload_URLMap[0], ",")
 
Local $sDownload_Link = _Download_fmtstream_GetOriginalLink($aDownload_URLMap)
If $sDownload_Link = "" Then
    ConsoleWrite("!>Original link NOT available" & @CrLf)
    Exit 1
EndIf
ConsoleWrite($sDownload_Link & @CrLf)
 
;~ ConsoleWrite("Downloading..." & @CrLf)
;~ Local $hDownload_1 = InetGet($sDownload_Link, $sDownload_VideoID & ".mp4")
;~ InetClose($hDownload_1)
 
Func _Download_fmtstream_GetOriginalLink($aFmtstream)
    Local Const $sFmtOriginal = "38"
    Local $aParamOrder[20] = ["url", "gcr", "upn", "source", "key", "mv", "cp", "ip", "expire", "ratebypass", "mt", "itag", "sparams", "ms", "ipbits", "sver", "fexp", "id", "sig"]
    Local $aParam = 0, $sFmtDecoded = ""
 
    For $i = 1 To $aFmtstream[0]
        $aFmtstream[$i] = _UnicodeURLDecode($aFmtstream[$i])
 
        $aParam = StringRegExp($aFmtstream[$i], "([^?&=]+)=([^?&]*)", 3)
 
        For $j = 0 To UBound($aParamOrder) - 1
            For $k = 0 To UBound($aParam) - 1 Step 2
                If $aParam[$k] <> $aParamOrder[$j] Then ContinueLoop
 
                If $j = 0 Then
                    $sFmtDecoded = $aParam[$k + 1] & "?"
                Else
                    If $aParam[$k] = "itag" And $aParam[$k + 1] <> $sFmtOriginal Then
                        $sFmtDecoded = ""
                        ExitLoop 2
                    ElseIf $aParam[$k] = "sig" Then
                        $aParam[$k] = "signature"
                    EndIf
 
                    $sFmtDecoded &= $aParam[$k] & "=" & $aParam[$k + 1] & "&"
                EndIf
 
                ExitLoop
            Next
        Next
 
        Return StringTrimRight($sFmtDecoded, 1)
    Next
EndFunc
 
; #FUNCTION# ====================================================================================================================
; Name...........: _UnicodeURLDecode
; Author ........: Dhilip89
; ===============================================================================================================================
Func _UnicodeURLDecode($toDecode)
    Local $strChar = "", $iOne = 0, $iTwo = 0
    Local $aryHex = StringSplit($toDecode, "")
 
    For $i = 1 To $aryHex[0]
        If $aryHex[$i] = "%" Then
            $i = $i + 1
            $iOne = $aryHex[$i]
            $i = $i + 1
            $iTwo = $aryHex[$i]
            $strChar = $strChar & Chr(Dec($iOne & $iTwo))
        Else
            $strChar = $strChar & $aryHex[$i]
        EndIf
    Next
 
    $strChar = StringReplace($strChar, "+", " ")
    $strChar = StringReplace($strChar, "%3A", ":")
    $strChar = StringReplace($strChar, "\/", "/")
    $strChar = StringReplace($strChar, "\u0026", "&")
 
    Return BinaryToString(StringToBinary($strChar), 4)
EndFunc
Br, FireFox. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

i wonder if he means mpeg4 quality ? youtube always offers a bunch of qualities like flv or mp3 and other formats.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

If you are still there, here you go :

;Author: FireFox @2013
#include <String.au3>
#include "WinHTTP.au3"
 
Local $sDownload_VideoID = "kIjjHeD-0dY"
 
Local Const $sFmtOriginal = "38"
 
Local Const $sHTTPUserAgent = "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0"
 
Local $hWinHttpOpen = _WinHttpOpen($sHTTPUserAgent)
Local $hWinHttpConnect = _WinHttpConnect($hWinHttpOpen, "www.youtube.com")
 
Local $hWinHttpRequest = _WinHttpOpenRequest($hWinHttpConnect, "GET", _
        "/watch?v=" & $sDownload_VideoID, _
        "HTTP/1.1")
 
_WinHttpSendRequest($hWinHttpRequest)
 
_WinHttpReceiveResponse($hWinHttpRequest)
 
Local $sDownload_Chunk = "", $sDownload_ResponseData = ""
While 1
    $sDownload_Chunk = _WinHttpReadData($hWinHttpRequest, 1)
    If @error Then ExitLoop
    $sDownload_ResponseData &= $sDownload_Chunk
WEnd
 
_WinHttpCloseHandle($hWinHttpRequest)
 
Local $aDownload_URLMap = _StringBetween($sDownload_ResponseData, '"url_encoded_fmt_stream_map": "', '", "')
 
If StringInStr($aDownload_URLMap[0], '"}};') > 0 Then
    $aDownload_URLMap[0] = StringLeft($aDownload_URLMap[0], StringInStr($aDownload_URLMap[0], '"}};'))
EndIf
 
$aDownload_URLMap = StringSplit($aDownload_URLMap[0], ",")
 
Local $sDownload_Link = _Download_fmtstream_GetOriginalLink($aDownload_URLMap)
If $sDownload_Link = "" Then
    ConsoleWrite("!>Original link NOT available" & @CrLf)
    Exit 1
EndIf
ConsoleWrite($sDownload_Link & @CrLf)
 
;~ ConsoleWrite("Downloading..." & @CrLf)
;~ Local $hDownload_1 = InetGet($sDownload_Link, $sDownload_VideoID & ".mp4")
;~ InetClose($hDownload_1)
 
Func _Download_fmtstream_GetOriginalLink($aFmtstream)
    Local $aParamOrder[20] = ["url", "gcr", "upn", "source", "key", "mv", "cp", "ip", "expire", "ratebypass", "mt", "itag", "sparams", "ms", "ipbits", "sver", "fexp", "id", "sig"]
    Local $aParam = 0, $sFmtDecoded = ""
 
    For $i = 1 To $aFmtstream[0]
        $aFmtstream[$i] = _UnicodeURLDecode($aFmtstream[$i])
 
        $aParam = StringRegExp($aFmtstream[$i], "([^?&=]+)=([^?&]*)", 3)
 
        For $j = 0 To UBound($aParamOrder) - 1
            For $k = 0 To UBound($aParam) - 1 Step 2
                If $aParam[$k] <> $aParamOrder[$j] Then ContinueLoop
 
                If $j = 0 Then
                    $sFmtDecoded = $aParam[$k + 1] & "?"
                Else
                    If $aParam[$k] = "itag" And $aParam[$k + 1] <> $sFmtOriginal Then
                        $sFmtDecoded = ""
                        ExitLoop 2
                    ElseIf $aParam[$k] = "sig" Then
                        $aParam[$k] = "signature"
                    EndIf
 
                    $sFmtDecoded &= $aParam[$k] & "=" & $aParam[$k + 1] & "&"
                EndIf
 
                ExitLoop
            Next
        Next
 
        Return StringTrimRight($sFmtDecoded, 1)
    Next
EndFunc
 
; #FUNCTION# ====================================================================================================================
; Name...........: _UnicodeURLDecode
; Author ........: Dhilip89
; ===============================================================================================================================
Func _UnicodeURLDecode($toDecode)
    Local $strChar = "", $iOne = 0, $iTwo = 0
    Local $aryHex = StringSplit($toDecode, "")
 
    For $i = 1 To $aryHex[0]
        If $aryHex[$i] = "%" Then
            $i = $i + 1
            $iOne = $aryHex[$i]
            $i = $i + 1
            $iTwo = $aryHex[$i]
            $strChar = $strChar & Chr(Dec($iOne & $iTwo))
        Else
            $strChar = $strChar & $aryHex[$i]
        EndIf
    Next
 
    $strChar = StringReplace($strChar, "+", " ")
    $strChar = StringReplace($strChar, "%3A", ":")
    $strChar = StringReplace($strChar, "\/", "/")
    $strChar = StringReplace($strChar, "\u0026", "&")
 
    Return BinaryToString(StringToBinary($strChar), 4)
EndFunc
Br, FireFox.

 

 

*.* Epic thanks!!

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Copy the link form YouTube or Facebook and paste it to <snip> or <snip> program, it will be automatically downloaded to your computer.  It doesn't matter what resolution you want, it can do it all. 

Edited by JLogan3o13

Share this post


Link to post
Share on other sites

Not to mention that this kind of discussion is now prohibited, per this thread.

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0