download triforce - direkter Download, Youtube, Rapidshare

  • Hi,

    ich offembare euch mal meine 3 Downloadskripts :)
    Bei dem Youtubescript poppt eine Inputbox auf in die man die url eingeben kann,
    bei den anderen beiden muss man eine liste erstellen die alle URL´s von den
    Dateien enthält die runtergeladen werden sollen.

    1. Youtube Contest.zip (ffmpeg wird hier benötigt um die flv in eine avi umzuwandeln)

    Spoiler anzeigen
    [autoit]

    ;#NoTrayIcon
    #include <Inet.au3>
    #include <String.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars",1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $URL,$SIZE,$PARSEDURL,$FILE

    [/autoit] [autoit][/autoit] [autoit]

    FileInstall("ffmpeg.exe",@ScriptDir&"\ffmpeg.exe")
    FileInstall("pthreadGC2.dll",@ScriptDir&"\pthreadGC2.dll")

    [/autoit] [autoit][/autoit] [autoit]

    $URL = InputBox("YTD","Youtube - URL: ","","",140,120)
    If $URL == "" Then
    Exit
    EndIf
    $PARSEDURL = parseyoutube ($URL)
    $FILE = FileSaveDialog ("YTB",@DesktopDir,"FlashVideo (*.flv)", 16 , "video.flv",0)
    If $FILE == "" Then
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    main()
    Func main()
    Local $lab_info

    If FileExists($FILE) Then
    FileDelete($FILE)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $SIZE = InetGetSize($PARSEDURL)
    If InetGet($PARSEDURL,$FILE, 1, 1) == 0 Then
    MsgBox(48,"YTB","Couldn´t download the file!")
    Exit
    EndIf

    GUICreate("Downloading...",200,40,-1,-1,BitOR(0x80000000,0x00C00000),-1,0)
    $lab_info = GUICtrlCreateLabel("",5,5,180,60)
    GUISetState(@SW_SHOW)

    While @InetGetActive
    GUICtrlSetData($lab_info,"read: "&@InetGetBytesRead&" bytes"&@CRLF&"remaining: "&$SIZE-@InetGetBytesRead&" bytes")
    Sleep(800)
    Wend
    GUIDelete()

    [/autoit] [autoit][/autoit] [autoit]

    If MsgBox(4,"YTB","Convert to .avi?") == 6 Then
    SplashTextOn ("YTB","Converting...",120,30)
    RunWait("ffmpeg.exe -i """& $FILE & """ """ & $FILE & ".avi" & """",@ScriptDir,@SW_HIDE)
    SplashOff()
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func parseyoutube ($URL)
    Local $sitecontents,$id,$tval,$tcode

    $sitecontents = _INetGetSource($URL)
    If $sitecontents == 0 Then
    MsgBox(48,"YTB","Couldn´t download the file!")
    Exit
    EndIf

    $tcode = _StringBetween($sitecontents, '"t": ', ' ')
    If @error <> 1 Then
    $tval = StringReplace($tcode[0], '"', "");
    $tval = StringReplace($tval, ',', "");
    EndIf

    $id = StringMid($URL, StringInStr($URL, "v=") + 2)

    Return "http://youtube.com/get_video?video_id=" & $id & "&t=" & $tval;
    EndFunc

    [/autoit]

    2. direkter Download Shortcuts.zip

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    Opt("MustDeclareVars",1)

    [/autoit] [autoit][/autoit] [autoit]

    Const $DLIST = @ScriptDir&"\dlist.txt"
    Local $fhandle,$line,$size,$name

    [/autoit] [autoit][/autoit] [autoit]

    $fhandle = FileOpen($DLIST,0)
    If $fhandle == -1 Then
    ConsoleWrite("Konnte die Datei "&$DLIST&" nicht oeffnen!"&@CRLF)
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    ; Lesen der File
    $line = FileReadLine($fhandle)
    If @error Then
    ConsoleWrite("Listenende oder Lesefehler!"&@CRLF)
    ExitLoop
    EndIf

    If StringIsSpace($line) Then
    ContinueLoop
    EndIf

    ; Informationssammlung
    $name = StringMid($line,StringInStr($line,"/",0,-1)+1)
    $size = InetGetSize($line)
    If $size == 0 Then
    ConsoleWrite($name& " hat eine groesse von "&$size&" bytes?!"&@CRLF)
    ContinueLoop
    EndIf

    ; Download
    ConsoleWrite($name&@CRLF&"---------------------------------------"&@CRLF)

    If InetGet($line,@ScriptDir&"\"&$name, 1, 1) == 0 Then
    ConsoleWrite($name& " konnte nicht runtergeladen werden!"&@CRLF)
    ContinueLoop
    EndIf

    While @InetGetActive
    ConsoleWrite(@InetGetBytesRead&" von "&$size&@CRLF)
    Sleep(5000)
    Wend

    ConsoleWrite("---------------------------------------"&@CRLF)
    WEnd
    Exit

    [/autoit]

    3. Rapidshare (mit hilfe eines videos von McPoldy) eurocom.zip

    Spoiler anzeigen
    [autoit]

    Opt("MustDeclareVars",1)

    [/autoit] [autoit][/autoit] [autoit]

    #include <IE.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Const $DLLIST = @ScriptDir&"\dlinks.txt"

    [/autoit] [autoit][/autoit] [autoit]

    main()
    Func main()
    Local $links,$ie

    $ie = _IECreate("about:blank")
    $links = getLinks()
    For $i=1 To $links[0] Step 1
    rsdownload($ie,$links[$i])
    Next

    _IEQuit($Ie)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func rsdownload($ie,$link)
    Local $form,$str

    _IENavigate($ie,$link)
    $form = _IEFormGetObjByName ($ie, "ff")
    _IEFormSubmit ($form,0)

    [/autoit] [autoit][/autoit] [autoit]

    _IELoadWait($ie)
    Do
    $form = _IEFormGetObjByName ($ie, "dlf")
    If $form = 0 Then Sleep(5000)
    Until $form <> 0

    [/autoit] [autoit][/autoit] [autoit]

    InetGet($form.action,@ScriptDir & '\download\' & StringMid($form.action,StringInStr($form.action,"/",0,-1)+1),1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func getLinks()
    Local $fhandle,$fcontents,$str,$line

    $str = ""
    $fhandle = FileOpen($DLLIST,0)
    While 1
    $line = FileReadLine($fhandle)
    If @error Then
    ExitLoop
    EndIf
    If StringInStr($line,"http://rapidshare.com/") <> 0 Then
    $str &= $line & "|"
    EndIf
    WEnd
    FileClose($fhandle)
    $str = StringTrimRight($str,1)
    Return StringSplit($str,"|")
    EndFunc

    [/autoit]