H4ckCoder Posted February 21, 2015 Share Posted February 21, 2015 #include Global $baseURL, $infoURL, $watchURL, $videoID, $videoQuality, $videoToken #include #include #include #Region ### START Koda GUI section ### Form= $formDownload = GUICreate("Form1", 503, 80, 192, 124) $Progress1 = GUICtrlCreateProgress(8, 8, 489, 25) $lbl = GUICtrlCreateLabel("0.00%", 200, 50) Download('http://www.youtube.com/watch?v=eCM32sZphXk&feature=related') Download('http://www.youtube.com/watch?v=-CwyDR38ZU8&feature=related') Func Download($srcURL) $baseURL = $srcURL $infoURL = 'http://www.youtube.com/get_video_info?video_id=' $watchURL = 'http://www.youtube.com/watch?v=' $videoID = _GetVideoId($baseURL) $videoQuality = _GetMaxQuality($videoID) $videoToken = _GetToken() $videoDownloadLink = 'http://www.youtube.com/get_video?video_id=' & $videoID & '&t=' & $videoToken & '&fmt=' & $videoQuality $savePath = FileSaveDialog("Video speichern...", @DesktopDir, 'MP4 Datei (*.mp4)', 2, 'youtube.mp4') $hDownload = InetGet($videoDownloadLink, $savePath, 1, 1) GUISetState(@SW_SHOW, $formDownload) #EndRegion ### END Koda GUI section ### Do Sleep(250) $proz = InetGetInfo($hDownload, 0) * 100 / InetGetInfo($hDownload, 1) $mod = Mod($proz, 1) ConsoleWrite(@LF & Round($proz, 2)) GUICtrlSetData($lbl, Round($proz, 2) & "%") GUICtrlSetData($Progress1, $proz - $mod) Until InetGetInfo($hDownload, 2) ; Check if the download is complete. Local $nBytes = InetGetInfo($hDownload, 0) InetClose($hDownload) GUISetState(@SW_HIDE,$formDownload) EndFunc ;==>$Download Func _GetToken() Global $workSRC = StringReplace(StringStripCR(_INetGetSource($watchURL & $videoID & '&fmt=' & $videoQuality)), @LF, '') $array = StringRegExp($workSRC, '"t": "(.*?)"', 1) If IsArray($array) Then Return $array[0] Else Return "NULL" EndIf EndFunc ;==>_GetToken Func _GetMaxQuality($vID) $workSRC = StringReplace(StringStripCR(_INetGetSource($infoURL & $vID)), @LF, '') $array = StringRegExp($workSRC, 'fmt_stream_map=(.*?)%', 1) If IsArray($array) Then Return $array[0] Else Return "NULL" EndIf EndFunc ;==>_GetMaxQuality Func _GetVideoId($url) $workSRC = StringReplace(StringStripCR(_INetGetSource($url)), @LF, '') $array = StringRegExp($workSRC, '', 1) If IsArray($array) Then Return $array[0] Else Return "NULL" EndIf EndFunc ;==>_GetVideoId This is the hidden content, please Sign In or Sign Up Link to comment Share on other sites More sharing options...
Recommended Posts