Version 1.0.2 released! (22-7-2009)
HISTORY
- V 1.0.1 : Fix some bugs
Edit Preview GUI
- V 1.0.2 : Add new features : auto get video url from clipboard
Plain Text
#NoTrayIcon #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\MANHQUYNHPHINHUNG\video2.ico #AutoIt3Wrapper_Outfile=..\..\TubeTake1-0-2.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Description=YouTube Downloader #AutoIt3Wrapper_Res_Fileversion=1.0.2.0 #AutoIt3Wrapper_Res_LegalCopyright=Huynh Minh Thanh #AutoIt3Wrapper_Res_Field=Website|huynhminhthanh.webs.com #AutoIt3Wrapper_Res_Field=Email|minhthanh.autoit@gmail.com #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Tidy_Stop_onerror=n #AutoIt3Wrapper_Run_Obfuscator=y #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** Opt('WinTitleMatchMode', 2) #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <IE.au3> #include <Inet.au3> #include <String.au3> HotKeySet('{Esc}', '_abort') HotKeySet('{F7}', '_geturl') HotKeySet('{F8}', 'Download') HotKeySet('{F9}', 'Quick') #Region ### START Koda GUI section ### Form=c:\documents and settings\welcome\desktop\minhthanh\Tube Take\get.kxf $Form = GUICreate("Tube Take 1.0.2 by Huynh Minh Thanh (LogMeIn)", 417, 157, -1, -1) GUISetBkColor(0xFFFFFF) $Input = GUICtrlCreateInput("", 11, 32, 345, 21) $Label1 = GUICtrlCreateLabel("Enter youtube video url here :", 8, 8, 143, 17) $Preview = GUICtrlCreateButton("&Preview", 359, 31, 51, 24, 0) $Label2 = GUICtrlCreateLabel("Save to :", 8, 56, 47, 17) $SavePath = GUICtrlCreateInput("", 11, 80, 345, 21) $Browsr = GUICtrlCreateButton("&...", 360, 79, 50, 24, 0) $Shutdown = GUICtrlCreateCheckbox("&Shutdown when done", 8, 104, 137, 17) $Opendownloaded = GUICtrlCreateCheckbox("&Open downloaded video", 152, 104, 137, 17) $Download = GUICtrlCreateButton("&Download", 8, 128, 83, 25, 0) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") ;$Preview = GUICtrlCreateButton("&Preview", 96, 128, 75, 25, 0) $Help = GUICtrlCreateButton("&?", 357, 128, 27, 25, 0) $Close = GUICtrlCreateButton("&X", 384, 128, 27, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;<iframe id="ytplayer" class="EmbeddedVideo" type="text/html" width="640" height="390" src="http://youtube.com/embed/wDiUG52ZyHQ?html5=1&fs=1" frameborder="0" allowfullscreen webkitallowfullscreen /></iframe> While 1 $nMsg = GUIGetMsg() If StringLeft(ClipGet (),31) = 'http://www.youtube.com/watch?v=' and Guictrlread ($input) <> StringLeft(ClipGet (),31) Then GUICtrlSetData ($input,ClipGet ()) EndIf If StringLeft(ClipGet (),31-7) = 'www.youtube.com/watch?v=' and Guictrlread ($input) <> StringLeft(ClipGet (),31-7) Then GUICtrlSetData ($input,ClipGet ()) EndIf Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() Case $Close _exit() Case $Download If FileExists(GUICtrlRead($SavePath)) And GUICtrlRead($Input) <> '' Then download() Else MsgBox(48, 'Tube Take', 'Please enter the video url or select a correct directory.', '', $Form) EndIf Case $Preview Preview() Case $Browsr $get = FileSelectFolder('Please select a directory', @DesktopDir, 5, GUICtrlRead($SavePath), $Form) If Not @error Then GUICtrlSetData($SavePath, $get) EndIf Case $Help MsgBox(262208, "About Tube Take", _ "TUBE TAKE" & @LF & _ "1.0.2" & @LF & _ "-------------------------------------------------------------------------" & @LF & _ "Easy to download videos from YouTube.com" & @LF & _ "-------------------------------------------------------------------------" & @LF & _ "Author : Huynh Minh Thanh (LogMeIn)" & @LF & _ "Website : huynhminhthanh.webs.com" & @LF & _ "Email : minhthanh.autoit@gmail.com" & @LF & _ "-------------------------------------------------------------------------" & @LF & _ "All comments or bugs report are welcome!", 0) EndSwitch WEnd Func _Exit() If @InetGetActive Then $msg1 = MsgBox(48 + 4, 'Tube Take', 'Are you sure to quit? All download progress will be stopped!', '', $Form) If $msg1 = 6 Then InetGet('abort') Exit EndIf Else Exit EndIf EndFunc ;==>_Exit Func Preview() $urls = GUICtrlRead($Input) If GUICtrlRead($Input) = '' Then MsgBox(32, 'Tube Take', 'Please enter YouTube video url!', '', $Form) Return EndIf FileDelete(@TempDir & '\TempDirtoPreview.html') $s = StringReplace(GUICtrlRead($Input), 'watch?v=', 'v/') $var1 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($s, '&feature=fvw', ''), '&feature=related', ''), '&feature=featured', ''), '&feature=popular', ''), '&feature=topvideos', ''), '&feature=fvhl', '') $var = StringReplace('<object width="560" height="340"><param name="movie" value="xxx"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="xxx" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>', 'xxx', $var1 & '&hl=en&fs=1&') FileWrite(@TempDir & '\TempDirtoPreview.html', $var) ConsoleWrite($var) $preGui = GUICreate('YouTube Preview : ' & GUICtrlRead($Input), 565 + 30, 360 + 50, -1, -1) $oie = _IECreateEmbedded() GUICtrlCreateObj($oie, 0, 0, 565 + 30, 345 + 50) _IENavigate($oie, @TempDir & '\TempDirtoPreview.html') GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($preGui) FileDelete(@TempDir & '\TempDirtoPreview.html') ExitLoop EndSwitch WEnd EndFunc ;==>Preview Func download() $urls = GUICtrlRead($Input) $urls2 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($urls, 'http://', ''), 'www.', ''), 'youtube.com/watch?v=', ''), '&feature=fvw', ''), '&feature=related', ''), '&feature=featured', ''), '&feature=popular', ''), '&feature=topvideos', ''), '&feature=fvhl', '') ProgressOn('Tube Take', 'Searching...', StringReplace(GUICtrlRead($Input), '&', '&&'), -1, -1, 18) ConsoleWrite($urls2 & @CRLF) $source = _INetGetSource('http://it.youtube.com/watch?v=' & $urls2) $string = _StringBetween($source, "&t=", "&hl=") $urls3 = 'video_id=' & $urls2 & '&t=' & $string[0] ConsoleWrite('Url : ' & $urls3 & @CRLF) $tit = _StringBetween($source, '&title=', "';") $title = $tit[0] ConsoleWrite($title & @CRLF) $finalurl = 'http://youtube.com/get_video?' & $urls3 ConsoleWrite($finalurl & @CRLF) InetGet($finalurl, GUICtrlRead($SavePath) & StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($title, '/', ' '), '\', ' '), ':', ' '), '?', ' '), '*', ' '), '"', ' '), '<', ' '), '>', ' '), '|', ' ') & '.flv', 0, 1) $fsize = InetGetSize($finalurl) While @InetGetActive ProgressSet((@InetGetBytesRead * 100) / $fsize, $urls & @CRLF & Round(@InetGetBytesRead / 1024 / 1024, 1) & ' Mb/' & Round($fsize / 1024 / 1024, 1) & ' Mb', 'Downloading... ' & $title) Sleep(300) WEnd ProgressOff() If @InetGetBytesRead = $fsize And GUICtrlRead($Shutdown) = 1 Then Shutdown(1) EndIf If @InetGetBytesRead = $fsize Then If GUICtrlRead($Opendownloaded) = 4 Then $msg2 = MsgBox(64 + 4, 'Tube Take', 'Completed!' & @CRLF & $urls & @CRLF & 'Would you like to play downloaded video now?', '', $Form) If $msg2 = 6 Then ShellExecute(GUICtrlRead($SavePath) & $title & '.flv') Else Return EndIf Else ShellExecute(GUICtrlRead($SavePath) & $title & '.flv') EndIf Else MsgBox(48, 'Tube Take', 'Download progress not completed!', '', $Form) EndIf EndFunc ;==>download ;http://www.youtube.com/watch?v= Func _abort() InetGet('abort') ProgressOff() EndFunc ;==>_abort Func _geturl() $g = ClipGet() If StringLeft($g, 31) = 'http://www.youtube.com/watch?v=' Then GUICtrlSetData($Input, $g) Else MsgBox(32, 'Tube Take', 'No link was found!', 5, $Form) EndIf EndFunc ;==>_geturl Func Quick() $g = ClipGet() If StringLeft($g, 31) = 'http://www.youtube.com/watch?v=' Then GUICtrlSetData($Input, $g) GUICtrlSetData($SavePath, @DesktopDir) download() Else MsgBox(32, 'Tube Take', 'No link was found!', 5, $Form) EndIf EndFunc ;==>Quick
Exe file and documentation can be found here : http://www.mediafire.com/?dn55jg3xv2z
Comments are welcome!!!
Edited by logmein, 22 July 2009 - 02:57 AM.





