und wie würde das ausehn?
Videos von YouTube mit AutoIt?
-
- [ offen ]
-
PokerFace -
3. April 2009 um 22:19 -
Geschlossen -
Erledigt
-
-
Das bekomm ich hin! =)
[autoit]
Also,
ein Check.If Not _isarray ($dwnlink) Then
[/autoit][autoit][/autoit][autoit]MsgBox (1, "Error", "Ungültiger Link!"
[/autoit][autoit][/autoit][autoit]Else
[/autoit][autoit][/autoit][autoit]-Code-Rest-
[/autoit][autoit][/autoit][autoit]EndIf
[/autoit] -
beep falsch!!!!
[autoit]
[url='http://www.autoit.de/dokumentation_aktuell/keywords.htm']If Not isarray ("dwnlink") Then
[/autoit][autoit][/autoit][autoit]MsgBox (1, "Error", "Ungültiger Link!"
[/autoit][autoit][/autoit][autoit]Else
[/autoit][autoit][/autoit][autoit]-Code-Rest-
[/autoit][autoit][/autoit][autoit]EndIf
[/autoit] -
oh
Vielen Dank =) -
[autoit]
#include <GUIConstants.au3>
[/autoit][autoit][/autoit][autoit]
#include <inet.au3>
#include <Date.au3>;~ FileInstall ("C:\ffmpeg.exe", "C:\Video\ffmpeg.exe")
[/autoit][autoit][/autoit][autoit];~ $Pfad = "C:\Video\ffmpeg.exe"
[/autoit][autoit][/autoit][autoit]
GUICreate("You Tube Video-Downloader", 273, 105, 193, 115, -1)
$DwnInput = GUICtrlCreateInput("Hier YouTube Link Rein !", 8, 24, 257, 21)
GUICtrlCreateLabel("www.youtube.com Download Link:", 8, 8, 268, 15)
$start = GUICtrlCreateButton("&Start", 8, 48, 128, 25, 0)
$Progress = GUICtrlCreateProgress(8, 80, 257, 16)
$abb = GUICtrlCreateButton("A&bbruch", 137, 48, 128, 25, 0)
GUISetState(@SW_SHOW)
[/autoit][autoit][/autoit][autoit]
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $start
GUICtrlSetState($start,$GUI_DISABLE)
$dwnlink = GUICtrlRead($DwnInput)
$sCode=_INetGetSource ($dwnlink)
$s_t=StringRegExp($sCode, "&t=(.*?)&", 3)
If Not IsArray ($s_t) Then
MsgBox (0, "Error", "Ungültiger Link!")
Exit
Else
$s_v=stringmid($dwnlink,stringinstr($dwnlink,"v=")+2)
$save = FileSaveDialog("Speichere FLV","","Flash Video (*.flv)",-1,$s_v)
If StringRight($save,4) <> ".swf" Then $save&=".flv"
_Download("http://youtube.com/get_video?video_id=" & $s_v & "&t=" & $s_t[0],$save,$Progress)
GUIDelete()
MsgBox(0,"","Fertig!")
EndIfEndSwitch
[/autoit]
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 = $abb Then
If MsgBox(4,"","Abbruch?") = 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 & ") Kb sind bereits gedownloadet.")
Else
GUICtrlSetData($prog,$Prozent)
EndIf
Until @InetGetActive = 0
If $prog = 0 Then ProgressOff ()
Local $sFFmpeg="", $hFFmpeg
$hFFmpeg=Run(@ScriptDir '\ffmpeg.exe -i "' & $punkt & '" -y "' & StringTrimRight($punkt,3) & 'avi"',@ScriptDir,@SW_HIDE,0x4)
While 1
$sFFmpeg &= StderrRead($hFFmpeg)
If @error Or StringInStr($sFFmpeg,"Duration") Then ExitLoop
WEnd
$sFFmpeg = StringLeft(StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "Duration:") + 9),
$iTicks = _TimeToTicks(StringLeft($sFFmpeg, 2), StringMid($sFFmpeg, 4, 2), StringMid($sFFmpeg, 7, 2))
While 1
$sFFmpeg = StderrRead($hFFmpeg)
If @error Then ExitLoop
If StringInStr($sFFmpeg,"time=") Then
$sFFmpeg=StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "time=") + 4)
GUICtrlSetData($prog,(StringLeft($sFFmpeg, StringInStr($sFFmpeg, ".")-1) *100000)/$iTicks)
EndIf
WEnd
Return $punkt
EndFuncBitte schön
Es klappt =) -
thx noch mal pokerface
die wollten sich meinen downloader in script bereich nich ansehn also sry..aber kann dir den quellcode gerne schicken wenn du willsthau rein team2way
-
zieht euch ma das rein mien download reagiert net auf links sondern suchbegriffe dh man gibt in dem feld hallo ein und er sucht den link vom ersten ideo mit dieser suche und lädt ihn runter testet es einfach mal
außerdem sind noch einige kleine veränderungen wie gesagt ihr werdet es merken...
die Func Youtube is nicht von Mir, sondern sie ist von Oger-Lord .... ich hab nur zwei zeichen geändert aber ich hab was geändert
naja gut:Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <inet.au3>
#include <Date.au3>
#include <string.au3>
GUICreate("You Tube Video-Downloader", 273, 105, 193, 115, -1)
$DwnInput = GUICtrlCreateInput("Hier YouTube Suchbegriff Rein !", 8, 24, 257, 21)
GUICtrlCreateLabel("www.youtube.com Suchbegriff:", 8, 8, 268, 15)
$start = GUICtrlCreateButton("&Start", 8, 48, 128, 25, 0)
$Progress = GUICtrlCreateProgress(8, 80, 257, 16)
$abb = GUICtrlCreateButton("A&bbruch", 137, 48, 128, 25, 0)
GUICtrlSetState($abb, $GUI_DISABLE)
GUISetState(@SW_SHOW)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $start
$youtube = _youtube(GUICtrlRead($DwnInput))
$NL = StringSplit($youtube, "~")GUICtrlSetData($DwnInput, $NL[1])
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($start, $GUI_DISABLE)
GUICtrlSetState($abb, $GUI_ENABLE)
$dwnlink = GUICtrlRead($DwnInput)
$sCode = _INetGetSource($dwnlink)
$s_t = StringRegExp($sCode, "&t=(.*?)&", 3)
$s_v = StringMid($dwnlink, StringInStr($dwnlink, "v=") + 2)
If Not IsArray ($s_t) Then
MsgBox (0, "Error", "Ungültiger Link!")
Exit
Else
$save = FileSaveDialog("Speichere FLV", "", "Flash Video(*.flv)", -1, $NL[2])
If StringRight($save, 4) <> ".swf" Then $save &= ".flv"
_Download("http://youtube.com/get_video?video_id=" & $s_v & "&t=" & $s_t[0], $save, $Progress)
$Re = MsgBox(4, "Video Behalten", "Willst du das flv Video behalten?")
If $Re = 7 Then FileDelete($save)
Sleep(200)
GUIDelete()
MsgBox(0, "", "Fertig!")
Exit
EndIfEndSwitch
[/autoit] [autoit][/autoit] [autoit]
WEndFunc _Download($site, $punkt, $prog = 0)
[/autoit] [autoit][/autoit] [autoit]
$orisize = InetGetSize($site)
InetGet($site, $punkt, 1, 1)
If $prog = 0 Then ProgressOn("Download", "")
Do
$msg = GUIGetMsg()
If $msg = $abb Then
If MsgBox(4, "", "Abbruch?") = 6 Then Exit
EndIf
$size1 = FileGetSize($punkt)
$MBsize1 = FileGetSize($punkt)
$inetget = @InetGetBytesRead
$Prozent = $inetget / $orisize * 100
$decimalplace = Round($Prozent)
$decimalplaceMBsize1 = Round(@InetGetBytesRead / 1024)
If $prog = 0 Then
ProgressSet($Prozent, $decimalplace & "% " & "(" & $decimalplaceMBsize1 & ") Kb sind bereits gedownloadet.")
Else
GUICtrlSetData($prog, $Prozent)
EndIf
Until @InetGetActive = 0
If $prog = 0 Then ProgressOff()
Local $sFFmpeg = "", $hFFmpeg
$hFFmpeg = Run(@ScriptDir & '\ffmpeg.exe -i "' & $punkt & '" -y "' & StringTrimRight($punkt, 3) & 'mp3"', @ScriptDir, @SW_HIDE, 0x4)
While 1
$sFFmpeg &= StderrRead($hFFmpeg)
If @error Or StringInStr($sFFmpeg, "Duration") Then ExitLoop
WEnd
$sFFmpeg = StringLeft(StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "Duration:") + 9),
$iTicks = _TimeToTicks(StringLeft($sFFmpeg, 2), StringMid($sFFmpeg, 4, 2), StringMid($sFFmpeg, 7, 2))
While 1
$sFFmpeg = StderrRead($hFFmpeg)
If @error Then ExitLoop
If StringInStr($sFFmpeg, "time=") Then
$sFFmpeg = StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "time=") + 4)
GUICtrlSetData($prog, (StringLeft($sFFmpeg, StringInStr($sFFmpeg, ".") - 1) * 100000) / $iTicks)
EndIf
WEnd
Return $punkt
EndFunc ;==>_Download
Func _youtube($suchbegriff)
InetGet("http://www.youtube.com/results?search_query=" & $suchbegriff, "C:\temp.temp")
Local $file = FileOpen("C:\temp.temp", 0)
$quelltext = FileRead($file)
FileClose($file)
FileDelete($file)$video = _StringBetween($quelltext, 'href="/watch?v=', '"')
[/autoit] [autoit][/autoit] [autoit]$name = _StringBetween($quelltext, 'rel="nofollow"><img title="', '"')
[/autoit] [autoit][/autoit] [autoit]If IsArray($video) And IsArray($name) Then
[/autoit]
Return "http://www.youtube.com/watch?v=" & $video[0] & "~" & $name[0]
Else
Return "Fehler, es wurde nichts gefunden!"
EndIf
EndFunc ;==>_youtube
gruß nonever -
@NoNever hi ich hab die begiffe: neu, hallo, noob, hund, usw eingegeben und bei allen kam die fehlermeldung
-
also wenn ich hallo eingebe dann klappt es bei mir wunderbar....
was kommt dem für eine meldung? -
also bei hallo kommt bei mir die meldung in der input "Fehler, es wurde nichts gefunden!" und die msg box "ungültiger link"
-
das ist nun wirklich seltsam weil es bei mir unter dem selben begriff funzt.....
[autoit]
ich mach nochmal den code:#include <GUIConstantsEx.au3>
[/autoit][autoit][/autoit][autoit]
#include <inet.au3>
#include <Date.au3>
#include <string.au3>
GUICreate("You Tube Video-Downloader", 273, 105, 193, 115, -1)
$DwnInput = GUICtrlCreateInput("Hier YouTube Suchbegriff Rein !", 8, 24, 257, 21)
GUICtrlCreateLabel("www.youtube.com Suchbegriff:", 8, 8, 268, 15)
$start = GUICtrlCreateButton("&Start", 8, 48, 128, 25, 0)
$Progress = GUICtrlCreateProgress(8, 80, 257, 16)
$abb = GUICtrlCreateButton("A&bbruch", 137, 48, 128, 25, 0)
GUICtrlSetState($abb, $GUI_DISABLE)
GUISetState(@SW_SHOW)While 1
[/autoit][autoit][/autoit][autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $start
$youtube = _youtube(GUICtrlRead($DwnInput))
$NL = StringSplit($youtube, "~")GUICtrlSetData($DwnInput, $NL[1])
[/autoit][autoit][/autoit][autoit]
GUICtrlSetState($start, $GUI_DISABLE)
GUICtrlSetState($abb, $GUI_ENABLE)
$dwnlink = GUICtrlRead($DwnInput)
$sCode = _INetGetSource($dwnlink)
$s_t = StringRegExp($sCode, "&t=(.*?)&", 3)
$s_v = StringMid($dwnlink, StringInStr($dwnlink, "v=") + 2)
If Not IsArray ($s_t) Then
MsgBox (0, "Error", "Ungültiger Link!")
Exit
Else
$save = FileSaveDialog("Speichere FLV", "", "Flash Video(*.flv)", -1, $NL[2])
If StringRight($save, 4) <> ".swf" Then $save &= ".flv"
_Download("http://youtube.com/get_video?video_id=" & $s_v & "&t=" & $s_t[0], $save, $Progress)
$Re = MsgBox(4, "Video Behalten", "Willst du das flv Video behalten?")
If $Re = 7 Then FileDelete($save)
Sleep(200)
GUIDelete()
MsgBox(0, "", "Fertig!")
Exit
EndIfEndSwitch
[/autoit][autoit][/autoit][autoit]
WEndFunc _Download($site, $punkt, $prog = 0)
[/autoit][autoit][/autoit][autoit]
$orisize = InetGetSize($site)
InetGet($site, $punkt, 1, 1)
If $prog = 0 Then ProgressOn("Download", "")
Do
$msg = GUIGetMsg()
If $msg = $abb Then
If MsgBox(4, "", "Abbruch?") = 6 Then Exit
EndIf
$size1 = FileGetSize($punkt)
$MBsize1 = FileGetSize($punkt)
$inetget = @InetGetBytesRead
$Prozent = $inetget / $orisize * 100
$decimalplace = Round($Prozent)
$decimalplaceMBsize1 = Round(@InetGetBytesRead / 1024)
If $prog = 0 Then
ProgressSet($Prozent, $decimalplace & "% " & "(" & $decimalplaceMBsize1 & ") Kb sind bereits gedownloadet.")
Else
GUICtrlSetData($prog, $Prozent)
EndIf
Until @InetGetActive = 0
If $prog = 0 Then ProgressOff()
Local $sFFmpeg = "", $hFFmpeg
$hFFmpeg = Run(@ScriptDir & '\ffmpeg.exe -i "' & $punkt & '" -y "' & StringTrimRight($punkt, 3) & 'mp3"', @ScriptDir, @SW_HIDE, 0x4)
While 1
$sFFmpeg &= StderrRead($hFFmpeg)
If @error Or StringInStr($sFFmpeg, "Duration") Then ExitLoop
WEnd
$sFFmpeg = StringLeft(StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "Duration:") + 9),
$iTicks = _TimeToTicks(StringLeft($sFFmpeg, 2), StringMid($sFFmpeg, 4, 2), StringMid($sFFmpeg, 7, 2))
While 1
$sFFmpeg = StderrRead($hFFmpeg)
If @error Then ExitLoop
If StringInStr($sFFmpeg, "time=") Then
$sFFmpeg = StringTrimLeft($sFFmpeg, StringInStr($sFFmpeg, "time=") + 4)
GUICtrlSetData($prog, (StringLeft($sFFmpeg, StringInStr($sFFmpeg, ".") - 1) * 100000) / $iTicks)
EndIf
WEnd
Return $punkt
EndFunc ;==>_Download
Func _youtube($suchbegriff)
InetGet("http://www.youtube.com/results?search_query=" & $suchbegriff, "C:\temp.temp")
Local $file = FileOpen("C:\temp.temp", 0)
$quelltext = FileRead($file)
FileClose($file)
FileDelete($file)$video = _StringBetween($quelltext, 'href="/watch?v=', '"')
[/autoit][autoit][/autoit][autoit]$name = _StringBetween($quelltext, 'rel="nofollow"><img title="', '"')
[/autoit][autoit][/autoit][autoit]If IsArray($video) And IsArray($name) Then
[/autoit]
Return "http://www.youtube.com/watch?v=" & $video[0] & "~" & $name[0]
Else
Return "Fehler, es wurde nichts gefunden!"
EndIf
EndFunc ;==>_youtube -
da kommt bei mir wieder der fehler... vllt können andere dein programm mal testen und berichterstatten
-
wenn du teamwiever hast kann ich dir zeigen dass es bei mir geht
-