Jump to content

youtube downloader.


Saime
 Share

Recommended Posts

Hi guys, I have just found this tool

#include <GUIConstants.au3>
#include <inet.au3>

GUICreate("YouTube Downloader", 223, 114, 193, 121, -1)
$DwnInput = GUICtrlCreateInput("", 8, 24, 201, 21)
GUICtrlCreateLabel("Video Link:", 8, 8, 198, 15)
$download = GUICtrlCreateButton("Download", 8, 48, 99, 25, 0)
$Progress = GUICtrlCreateProgress(8, 80, 202, 16)
$cancel = GUICtrlCreateButton("Cancel", 112, 48, 99, 25, 0)
$about = GUICtrlCreateLabel ("Made by: Arturo",65,100,240,21)
$filename = "Saime"
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $download
            GUICtrlSetState($download,$GUI_DISABLE)
            $dwnlink = GUICtrlRead($DwnInput)
            $sCode=_INetGetSource ($dwnlink)
            $s_t=StringRegExp($sCode, "&t=(.*?)&", 3)
            $s_v=stringmid($dwnlink,stringinstr($dwnlink,"v=")+2)
            $save = FileSaveDialog("Save File ...","","FLV(*.flv)",-1, $filename)
            If StringRight($save,4) <> ".swf" Then $save&=".swf"
            _Download("http://youtube.com/get_video?video_id=" & $s_v & "&t=" & $s_t[0],$save,$Progress)
            GUIDelete()
            MsgBox(0,"","Done!")
            Exit
    EndSwitch
WEnd

Func _Download($site,$punkt,$prog=0)
    $orisize = InetGetSize($site)
    InetGet($site,$punkt,1,1)
    If $prog = 0 Then ProgressOn("Download","")
    Do
        $msg = GUIGetMsg()
        If $msg = $cancel Then
            If MsgBox(4,"","Cancel Download (?)") = 6 Then Exit
        EndIf
        $size1 = FileGetSize($punkt)
        $MBsize1 = FileGetSize($punkt)
        $inetget = @InetGetBytesRead
        $Prozent = (100 * $inetget ) / $orisize
        $decimalplace = Round ($Prozent)
        $decimalplaceMBsize1 = Round (@InetGetBytesRead / 1024)
        If $prog = 0 Then
            ProgressSet ($Prozent, $decimalplace  & "% " & "(" & $decimalplaceMBsize1 & ") Downloaded In Total ...")
        Else
            GUICtrlSetData($prog,$Prozent)
        EndIf
    Until @InetGetActive = 0
    If $prog = 0 Then ProgressOff ()
    Return $punkt
EndFunc

So what want to ask is, could someone edit the source, so I can download more just one video at time please?

Link to comment
Share on other sites

Hi,

InetGet() can not be called again until the previous download is finished.

But you can call a second copy of the script, and then run the InetGet.

BTW, look at my project (YouTube Download Center) from my signature, in future i will try to add an option that allows adding videos to queue (so the videos will be downloaded one after another (if there is any).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...