Jump to content

Youtube video downloader


Recommended Posts

Well I only spent an hour on this so dont be so harsh ;-) It does work with several bugs ....

Basically I spent a few hours trolling and downloading an ever increasing list of youtube shareware video downloaders. Most dont have batch downloading and dont support file renaming. So I decided to have a crack at making my own, I didnt go for an app that downloads directs from youtube but thru the site vixy.net mainly because I like there encoding.

THe probelm I am having is recieving responses from the site when its finished encoding my file and is ready to give me a link to download,currently I put a 40 second sleep which is obviously sub standard. Also I want the youtube site to not load completly , all I do with this extra page is grab the title for file renaming purposes. It just wastes bandwidth by downloading the video twice. Can anyone offer any suggestions on how I can handle webpage responses and maybe not load the youtube page by getting the video title an alternative way.

Also the downloading tray tip doesnt work :-X

You also have to make a file called 'url.txt' , heres some small sample video links to put in there

http://www.youtube.com/watch?v=TGdOy-1-51o

http://www.youtube.com/watch?v=iSUlRkDDWBU

http://www.youtube.com/watch?v=UnyekifYb2U

#include <IE.au3>
#include <file.au3>
AutoItSetOption ("WinTitleMatchMode", 4)
Dim $aRecords
Dim $title
If Not _FileReadToArray("url.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

$oIE = _IECreate("http://vixy.net/")
$oIE2 = _IECreate("http://www.google.com")

For $x = 1 to $aRecords[0]
    _IENavigate($oIE,"http://vixy.net/")
    _IENavigate($oIE2,$aRecords[$x])
    
;_IELoadWait($oIE)
$oForm  = _IEFormGetCollection($oIE,0)


;put movie url in form
$oURL = _IEFormElementGetObjByName($oForm,'u')
_IEFormElementSetValue($oURL,$aRecords[$x])

;Select formating option 
;".avi" AVI for Windows (DivX + MP3)
;".mov" MOV for Mac (MPEG4 + MP3)
;".mp4" MP4 for iPod/PSP (MPEG4 + AAC)
;".3gp" 3GP for Mobile (MPEG4 + AAC)
;".mp3" MP3 (audio only)
$oOPT = _IEFormElementGetObjByName($oForm,'e')
_IEFormElementOptionselect($oOPT,".avi")

;Click button to Process
    $oDoc = _IEDocGetObj ($oIE)
    $forms = _IEFormGetCollection ($oDoc)
        For $form in $forms
            $frmobjs = _IEFormElementGetCollection ($form)
                For $frmobj in $frmobjs
                    $value = $frmobj.value
                    if $value = "Start" Then
                        $butname = $frmobj.name  ; might have to use $frmobj.id instead
                        $oButton = _IEFormElementGetObjByName($form,$butname)
                        _IEAction($oButton, "click")            
                        endif
                    Next
                Next
                
                
                $oDoc = _IEDocGetObj ($oIE2)
                $filename = StringReplace($oDoc.title, "YouTube - ", "") & ".avi"
                
Sleep(40000)
        

; Get links off Website         
$oLinks = _IELinkGetCollection ($oIE) 
For $oLink In $oLinks
    if StringInStr($oLink.href,"flvdl?") = True then ;See if the link is download link
    InetGet($oLink.href,$filename)
    While @InetGetActive
    TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)
    Sleep(250)
    Wend
    EndIf
Next

Next

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

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...