Hi!
Kann mir niemand einen Tipp geben, wie ich weiter vorgehen kann?
Ich sehe die "anhang.zip" wurde schon 2 mal heruntergeladen...
LG. chris.
Beiträge von christopher
-
-
Hi!
Danke, @Andy für die Hilfe!
So, ich möchte mich über OAuth 2.0, in Youtube anmelden, damit ich den Autorisierungstooken bekomme...
Der ist nötig, um Videos mit hilfe der Api zu Liken usw.
Dies ganze findet in der Youtube Api v3 stadt und ist auch nicht im Browser, sondern über Winhttprequest.5.1.
Ich benutze keine Versteckten Browser aufrufe, da ich die methode über Winhttprequest viel eleganter und schneller halte.Jetzt ist die Frage, ist über Winhttprequest auch eine OAuth 2.0 anmeldung möglich?
Wenn ja, wie kann ich das am bessten angehn?
Ich hab mich schon eingehend damit beschäftigt, allerdings krieg ich das nicht hin... Zusätzlich kenn ich mich mit dem OAuth protokol nicht sehr gut aus.
Hier mal der 1. Schritt, ein Minimal beispiel. Wenn ich das ausführe, bekomm ich eine schöne anmeldungsseite, aber ich möchte die Login-Daten in einem GUI eingeben, d.h. in einer eigenen Inputbox. Geht das? Denn ich möchte auch die Funktion haben, dass die nutzerdaten verschluesselt gespeichert werden, dass man nicht immer bei jedem Start die Daten eintippen muss.
Aber, dass ist ja nicht schwer, vorraus gesetzt, ich schaffe es, ab hier dann mit Variablen den Anmeldeprozess vortzusetzen, ohne das ein Browser gebraucht wird.
Also, hier mal der 1. Schritt in Autoit:Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
; Die Daten, die gesendet werden sollen
$sPD= 'client_id=15113065612-b3gcjk8fphcm7lnu8nfonh7dvso7ldjq.apps.googleusercontent.comredirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/youtube'
; Erstellung des Objekts
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "https://accounts.google.com/o/oauth2/auth", False)
$oHTTP.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
; Ausführen des Requests
$oHTTP.Send($sPD)
; Download des HTML-Codes und auswertung des Serverstatuses
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.StatusIf $oStatusCode <> 200 then
[/autoit] [autoit][/autoit] [autoit]
MsgBox(4096, "Response code", $oStatusCode)
EndIf
; Speichert den Html-Code
$file = FileOpen("Received.html", 2)FileWrite($file, $oReceived)
[/autoit]
FileClose($file)In der angehängten Datei "anhang.zip", sind die 1. Schritt in autoit und der zurück gegebene HTML-Code gespeichert...
Infos über den Anmelde prozess findet ihr hier:
https://developers.google.com/youtube/v3/gui…#installed-apps
Auch weiss ich, dass die frage schon einige male gestellt wurde, aber dort gab es keine zufriedenstellende Antworten... Wenn man hier im Forum gräbt, findet man auch einen Thread, allerdings ist dort von der API v2 die rede und ich glaube kaum, dass ich den Tooken von Api V2 in API v3 auch verwenden kann...Kann mir jemand in dieser richtung Tipps und/oder Hilfestellung geben?
Hoffe, ihr könnt mir weiter helfen...
LG. Chris.
-
Hi!
Ich hab folgendes Problem:
Ich kann keine Neuen Themen mehr erstellen, da die bedienbarkeit für Blinde, der seite, sich leider verschlechtert hat.
Jedenfalls kann ich kein Label auswählen, dort steht immer "keine auswahl"
Da immer der Fehler kommt, dass ich doch ein Label auswählen soll, aber ich dies mit meinem Screenreader nicht kann, kann ich momentan keine neuen Themen erstellen...
Ich hoffe, dafür gibt es eine lösung.
LG. Chris. -
Hi!
[autoit]
Ich habe den Fehler gefunden.
Die doppelschleife war das problem, diese hab ich aber gemacht, um es zu ermöglichen das Player-Fenster zu schliessen ohne, dass das programm beendet wird, sondern wieder das andere GUI angezeigt wird...
Wisst ihr da eine lösung?
Und noch etwas:
Ich habe das Skript etwas umgebaut, und die Player wiedergabe klappt auch gut.
Ich habe über
[/autoit]
controlclick()
[autoit]
versucht, dass Flashplayer objekt zu fokussieren, aber dies gibt 0 zurück, ich weiss nicht warum.
Und das über
[/autoit]
MouseClick()
zumachen ist ein wenig unprofessionell, zusätzlich wird dann das Vidio Pausiert.
Geht das irgendwie das ganze so zu fokussieren das man das ganze mit der Tastertur bedienen kann?Ausserdem klappt zwar die Fenstertitel setzung, aber es ist der falsche titel, der kommt zwar auch in der Liste vor, aber meist am ende der Liste.
[autoit]
Ein minimal beispiel kann ich erlich gesagt nicht schreiben, weil ich so gut wie keine ahnung habe, wie die Funktionen genau arbeiten. Grob umrissen ja, aber genau nicht.
deswegen suche ich nach einem Tutorial o.ä. für das objekt orentierte programmieren für Autoit.
Sorry, dass ich euch mit fragen bombadiere und das ganze wahrscheinlich nervig ist...
:$
Fals ihr mir einen rat geben könnt, bin ich sehr dankbar.
hier also die aktuellste version des Codes (auch im anhang, aber nur die youtube client.au3, da die anderen Dateien ja gleich geblieben sind):
[spoiler]
[/autoit][autoit][/autoit][autoit]
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <IE.au3>
#include "YouTubeAPI.au3"
#include "Youtube.au3"Global $oCollection
[/autoit][autoit][/autoit][autoit]Func ToMinutes($iSeconds)
[/autoit][autoit][/autoit][autoit]
Local $iSec = Mod($iSeconds, 60)
If $iSec < 10 Then $iSec = "0" & $iSec
Return Floor($iSeconds / 60) & ":" & $iSec
EndFunc ;==>ToMinutes$oIE = _IECreateEmbedded()
[/autoit][autoit][/autoit][autoit]
$formMain = GUICreate("YouTube Client", 418, 466, 192, 164)$inpWord = GUICtrlCreateInput("test", 8, 8, 321, 21)
[/autoit][autoit][/autoit][autoit]
GUICtrlSetState($inpWord, $GUI_FOCUS) ; Der Fokus ist auf diesem Element
$btnSearch = GUICtrlCreateButton("Suche", 330, 7, 81, 23)
$lswResults = GUICtrlCreateListView("Titel | Länge", 8, 32, 401, 393)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 320)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 60)
$btnPlay = GUICtrlCreateButton("Wiedergabe", 8, 432, 401, 25)Dim $aItems[50]
[/autoit][autoit][/autoit][autoit]
Dim $aVID[50]GUISetState(@SW_SHOW)
[/autoit][autoit][/autoit][autoit]While True
[/autoit][autoit][/autoit][autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $btnSearch
For $i = 0 To 49
GUICtrlDelete($aItems[$i])
Next
$oCollection = YouTube_SearchVideos(GUICtrlRead($inpWord), 50, 1, $YT_BY_VIEWS, $YT_LANG_GERMAN)
;Suche nach Video, (50 - max Ergebnisse und auf Deutsch)
For $i = 0 To YouTube_GetVideosCount($oCollection) - 1
YouTube_SelectIndex($oCollection, $i)
;wählt ein Vidio aus, zur verarbeitung
$aItems[$i] = GUICtrlCreateListViewItem(StringReplace(YouTube_GetTitle($oCollection), "|", "") & "|" & ToMinutes(YouTube_GetDuration($oCollection)), $lswResults)
$aVID[$i] = YouTube_GetVID($oCollection)
; für jedes gefundene Vidio die Vidio-ID ermitteln
Next
Case $btnPlay
For $i = 0 To 49
If GUICtrlRead($lswResults) = $aItems[$i] Then ExitLoop
Next$vidio_title = YouTube_GetTitle($oCollection)
[/autoit][autoit][/autoit][autoit]
$form_player = GUICreate($vidio_title, 600, 600, 100, 200)YouTube_SelectIndex($oCollection, $i) ; Wählt das aktive Objekt in der Sammlung
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]
$vidio_id = YouTube_GetVID($oCollection)
$form_player = GUICreate($vidio_title, 600, 600, 100, 200)
$oFlash = ObjCreate("ShockwaveFlash.ShockwaveFlash.11")
$objPlayer = GUICtrlCreateObj($oFlash, 8, 40, 489, 393)
GUISetState(@SW_SHOW)
$oVideo = YouTube_GetVideo($vidio_id)
$oContent = YouTube_GetContentFlash($oVideo)
$oFlash.Movie = $oContent & "&autoplay=1" ;& "&controls=1"
$controlclick = ControlClick($vidio_title,"",$objPlayer)$nMsg1 = GUIGetMsg()
[/autoit][autoit][/autoit][autoit][/autoit][autoit]
Switch $nMsg1
Case $GUI_EVENT_CLOSE
_Youtube_Stop($a_youtubeplayer)
GUIDelete()
EndSwitchEndSwitch
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
WEndLG. Chris.
-
Hi!
Ok, hab ich gemacht, jetzt wird alles includet, Youtube.au3 und YoutubeAPI.au3.
hier nochmal die Codes für die Dateien, liegen auch im Anhang:
Youtube client.au3:Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <IE.au3>
#include "YouTubeAPI.au3"
#include "Youtube.au3"Global $oCollection
[/autoit] [autoit][/autoit] [autoit]$oIE = _IECreateEmbedded()
[/autoit] [autoit][/autoit] [autoit]
$formMain = GUICreate("YouTube Client", 418, 466, 192, 164)
$oFlash = ObjCreate("ShockwaveFlash.ShockwaveFlash.11")
$objPlayer = GUICtrlCreateObj($oFlash, 8, 40, 489, 393)$inpWord = GUICtrlCreateInput("test", 8, 8, 321, 21)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($inpWord, $GUI_FOCUS) ; Der Fokus ist auf diesem Element
$btnSearch = GUICtrlCreateButton("Suche", 330, 7, 81, 23)
$lswResults = GUICtrlCreateListView("Titel | Länge", 8, 32, 401, 393)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 320)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 60)
$btnPlay = GUICtrlCreateButton("Wiedergabe", 8, 432, 401, 25)Dim $aItems[200]
[/autoit] [autoit][/autoit] [autoit]
Dim $aVID[20]GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $btnSearch
For $i = 0 To 19
GUICtrlDelete($aItems[$i])
Next
$oCollection = YouTube_SearchVideos(GUICtrlRead($inpWord), 20, 1, $YT_BY_VIEWS, $YT_LANG_GERMAN)
;Suche nach Video, (20 - max Ergebnisse und auf Deutsch)
For $i = 0 To YouTube_GetVideosCount($oCollection) - 1
YouTube_SelectIndex($oCollection, $i)
;wählt ein Vidio aus, zur verarbeitung
$aItems[$i] = GUICtrlCreateListViewItem(StringReplace(YouTube_GetTitle($oCollection), "|", "") & "|" & ToMinutes(YouTube_GetDuration($oCollection)), $lswResults)
$aVID[$i] = YouTube_GetVID($oCollection)
; für jedes gefundene Vidio die Vidio-ID ermitteln
Next
Case $btnPlay
For $i = 0 To 199
If GUICtrlRead($lswResults) = $aItems[$i] Then ExitLoop
Next
;~ $youtube_source = _Youtube_Read($vidio_id)
$vidio_title = YouTube_GetTitle($oCollection)
$form_player = GUICreate($vidio_title, 600, 600, 100, 200)YouTube_SelectIndex($oCollection, $i) ; Wählt das aktive Objekt in der Sammlung
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$vidio_id = YouTube_GetVID($oCollection)
$a_youtubeplayer = _Youtube_Create(120, 220)
GUISetState(@SW_SHOW)
$vidio_load_process = _Youtube_Load($a_youtubeplayer, $youtube_source)
GUICtrlSetState($a_youtubeplayer, $GUI_FOCUS) ; Der Fokus ist auf diesem ButtonWhile True
[/autoit] [autoit][/autoit] [autoit]
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $GUI_EVENT_CLOSE
_Youtube_Stop($a_youtubeplayer)
GUIDelete()
EndSwitch
WEndEndSwitch
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]
WEndVon Youtube.au3:
Spoiler anzeigen
[autoit][/autoit] [autoit][/autoit] [autoit]#cs
[/autoit] [autoit][/autoit] [autoit]Functions:
[/autoit] [autoit][/autoit] [autoit]_Youtube_Read($iID)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]_Youtube_GetID($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
_Youtube_GetTitle($sPlayer)
_Youtube_GetDescription($sPlayer)
_Youtube_GetKeywords($sPlayer)_Youtube_GetEmbedLink($sPlayer)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_Youtube_GetPlayerLink($sPlayer)
_Youtube_GetPlayerSwf($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
_Youtube_Create($iX, $iY, $iWidth=$YT_DEFAULTWIDTH, $iHeight=$YT_DEFAULTHEIGHT)
_Youtube_Load($aPlayerControl, $sPlayer, $iAutoPlay=True)
_Youtube_Stop($aPlayerControl)#CE
[/autoit] [autoit][/autoit] [autoit]#include-once
[/autoit] [autoit][/autoit] [autoit]
#include <INet.au3>
#include <IE.au3>Global Const $YT_DEFAULTWIDTH = 425
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_DEFAULTHEIGHT = 344; Downloads the source of the Youtube page
[/autoit] [autoit][/autoit] [autoit]
; $iID = Video ID (example: "sNzEQ8hG1zA")Func _Youtube_Read($iID)
[/autoit] [autoit][/autoit] [autoit]
$sSource = _INetGetSource('http://youtube.com/watch?v='&$iID)
Return $sSource
EndFunc; Creates a embedded IE control for playing Youtube movies
[/autoit] [autoit][/autoit] [autoit]
; $iX, $iY, $iWidth, $iHeight = Coordinates of the controlFunc _Youtube_Create($iX, $iY, $iWidth=$YT_DEFAULTWIDTH, $iHeight=$YT_DEFAULTHEIGHT)
[/autoit] [autoit][/autoit] [autoit]
Local $aReturn[2]
$oIE = _IECreateEmbedded()
$hObj = GUICtrlCreateObj($oIE, $iX, $iY, $iWidth, $iHeight)
_IENavigate ($oIE, "about:blank", 0)
_IEDocWriteHTML($oIE, '<body bgcolor="Black"></body>')
$aReturn[0] = $oIE
$aReturn[1] = $hObj
Return $aReturn
EndFunc; Loads a movie into a player control.
[/autoit] [autoit][/autoit] [autoit]
; $aPlayerControl = A player control (return value of _Youtube_Create)
; $sPlayer = A movie (return value of _Youtube_Read)
; [$iAutoPlay] = Automaticly starts playing the movie if True.Func _Youtube_Load($aPlayerControl, $sPlayer, $iAutoPlay=True)
[/autoit] [autoit][/autoit] [autoit]
If $iAutoPlay Then
$sURL = _Youtube_GetPlayerLink($sPlayer)
Else
$sURL = _Youtube_GetEmbedLink($sPlayer)
EndIf
_IENavigate ($aPlayerControl[0], $sURL, 0)
Return 1
EndFunc; Stops playing a movie
[/autoit] [autoit][/autoit] [autoit]
; $aPlayerControl = Player control (return value of _Youtube_Create)Func _Youtube_Stop($aPlayerControl)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_IENavigate ($aPlayerControl[0], "about:blank", 0)
_IEDocWriteHTML($aPlayerControl[0], '<body bgcolor="Black"></body>')
EndFuncFunc _Youtube_GetKeywords($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,'<meta name="keywords" content=')
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen('<meta name="keywords" content=')-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,'<meta name="keywords" content=')
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen('<meta name="keywords" content=')-1)
$sAfterPlayerLink = StringTrimRight($sAfterPlayerLink,2)
$sAfterPlayerLink = StringTrimLeft($sAfterPlayerLink,1)
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetEmbedLink($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var embedUrl = ")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var embedUrl = ")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var embedUrl = ")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var embedUrl = ")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,";","")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"'","")
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetID($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var pageVideoId = ")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var pageVideoId = ")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var pageVideoId = ")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var pageVideoId = ")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,";","")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"'","")
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetDescription($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,'<meta name="description" content=')
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen('<meta name="description" content=')-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,'<meta name="description" content=')
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen('<meta name="description" content=')-1)
$sAfterPlayerLink = StringTrimRight($sAfterPlayerLink,2)
$sAfterPlayerLink = StringTrimLeft($sAfterPlayerLink,1)
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetTitle($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,'<meta name="title" content=')
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen('<meta name="title" content=')-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,'<meta name="title" content=')
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen('<meta name="title" content=')-1)
$sAfterPlayerLink = StringTrimRight($sAfterPlayerLink,2)
$sAfterPlayerLink = StringTrimLeft($sAfterPlayerLink,1)
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetPlayerLink($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSWF = _Youtube_GetPlayerSwf($sPlayer)
If Not $sSWF Then Return ""
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var swfArgs = {")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var swfArgs = {")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var swfArgs = {")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var swfArgs = {")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"};","")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,'"',"")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,": ","=")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,", ","&")
;$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"null","0")
Return $sSWF&"?"&$sAfterPlayerLink
EndFuncFunc _Youtube_GetPlayerSwf($sPlayer)
[/autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var swfUrl = ")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var swfUrl = canPlayV9Swf() ? ")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var swfUrl = ")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var swfUrl = canPlayV9Swf() ? ")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"'","")
$aSplit = StringSplit($sAfterPlayerLink," ")
Return $aSplit[1]
EndFunc
Und zuletzt von YoutubeAPI.au3:Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
; #INCLUDE# ====================================================================================================================
; Name ..........: YouTubeAPI
; Author ........: PunisherAxe
; Version .......: 1.2
; ===============================================================================================================================Global Const $YT_BY_RELEVANCE = "relevance"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_BY_VIEWS = "viewCount"
Global Const $YT_BY_PUBLISHED = "published"
Global Const $YT_BY_RATING = "rating"Global Const $YT_TIME_HOUR = "hour"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_TIME_TODAY = "today"
Global Const $YT_TIME_WEEK = "this_week"
Global Const $YT_TIME_MONTH = "this_month"
Global Const $YT_TIME_YEAR = "year"
Global Const $YT_TIME_ALL = "time_all"Global Const $YT_LANG_POLISH = "pl"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_LANG_ENGLISH = "en"
Global Const $YT_LANG_GERMAN = "de"Global Const $YT_DURATION_SHORT = "short"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_DURATION_MEDIUM = "medium"
Global Const $YT_DURATION_LONG = "long"Global Const $YT_CAPTION_TRUE = True
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_CAPTION_FALSE = FalseGlobal Const $YT_HD_TRUE = True
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_HD_FALSE = FalseFunc YouTube_GetVIDFromURL($sWatch)
[/autoit] [autoit][/autoit] [autoit]
Local $aResults = StringRegExp($sWatch, "(|\?|&)v=([\w|\-]+)", 3)
If Not IsArray($aResults) Then Return SetError(1, 0, 0)
Return $aResults[1]
EndFunc ;==>YouTube_GetVIDFromURLFunc YouTube_GetVideo($sVID)
[/autoit] [autoit][/autoit] [autoit]
Local $sResults, $sURL, $oVideo, $oHTTP
$sURL = "http://gdata.youtube.com/feeds/api/videos/" & $sVID & "?v=2&alt=json"
$oVideo = ObjCreate("ScriptControl")
$oVideo.language = "JScript"
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $sURL)
;$oHTTP.SetRequestHeader("Content-Type", "application/json; charset=utf-8")
$oHTTP.Send()
$oHTTP.WaitForResponse()
$sResults = $oHTTP.ResponseText
$oVideo.Eval("var video = (" & $sResults & ");")
If StringLeft($sResults, 6) == "<error" Then Return SetError(1, 0, 0)
Return $oVideo
EndFunc ;==>YouTube_GetVideoFunc YouTube_SearchVideos($sQuestion, $iMaxResults = 10, $iStartIndex = 1, $sOrderBy = $YT_BY_RELEVANCE, $sLang = "", $sCategory = "", $sAuthor = "", $sDuration = "", $sTime = "", $bHD = "", $bCaption = "")
[/autoit] [autoit][/autoit] [autoit]
Local $sResults, $sURL, $oVideo, $oHTTP
If $sLang <> "" Then $sLang = "&lr=" & $sLang
If $sCategory <> "" Then $sCategory = "&category=" & $sCategory
If $sAuthor <> "" Then $sAuthor = "&author=" & $sAuthor
If $sDuration <> "" Then $sDuration = "&duration=" & $sDuration
If $sTime <> "" Then $sTime = "&time=" & $sTime
If $bHD <> "" Then
If $bHD = True Then
$bHD = "&hd=true"
Else
$bHD = "&hd=false"
EndIf
EndIf
If $bCaption <> "" Then
If $bCaption = True Then
$bCaption = "&caption"
Else
$bCaption = ""
EndIf
EndIf
$sURL = "https://gdata.youtube.com/feeds/api/videos?q=" & $sQuestion & "&orderby=" & $sOrderBy & "&start-index=" & $iStartIndex & "&max-results=" & $iMaxResults & $bHD & $sDuration & $sAuthor & $sCategory & $sTime & "&v=2&alt=json"
$oVideo = ObjCreate("ScriptControl")
$oVideo.language = "JScript"
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $sURL)
$oHTTP.Send()
$oHTTP.WaitForResponse()
$sResults = $oHTTP.ResponseText
$oVideo.Eval("var collection = (" & $sResults & ");")
If StringLeft($sResults, 6) == "<error" Then Return SetError(1, 0, 0)
Return $oVideo
EndFunc ;==>YouTube_SearchVideosFunc YouTube_SelectIndex(ByRef $oCollection, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
$oCollection.Eval('var video = {"entry" : collection.feed.entry[' & $iIndex & ']};')
EndFunc ;==>YouTube_SelectIndexFunc YouTube_GetVideosCount($oCollection)
[/autoit] [autoit][/autoit] [autoit]
Return $oCollection.Eval("collection.feed.entry.length")
EndFunc ;==>YouTube_GetVideosCountFunc YouTube_GetLikes($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.yt$rating.numLikes")
EndFunc ;==>YouTube_GetLikesFunc YouTube_GetDislikes($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.yt$rating.numDislikes")
EndFunc ;==>YouTube_GetDislikesFunc YouTube_GetViews($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.yt$statistics.viewCount")
EndFunc ;==>YouTube_GetViewsFunc YouTube_GetRaters($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.numRaters")
EndFunc ;==>YouTube_GetRatersFunc YouTube_GetAverageRating($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.average")
EndFunc ;==>YouTube_GetAverageRatingFunc YouTube_GetMaxRating($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.max")
EndFunc ;==>YouTube_GetMaxRatingFunc YouTube_GetMinRating($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.min")
EndFunc ;==>YouTube_GetMinRatingFunc YouTube_GetTitle($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$title.$t")
EndFunc ;==>YouTube_GetTitleFunc YouTube_GetCategory($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$category[" & $iIndex & "].$t")
EndFunc ;==>YouTube_GetCategoryFunc YouTube_GetDuration($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.yt$duration.seconds")
EndFunc ;==>YouTube_GetDurationFunc YouTube_GetUploaded($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return StringReplace(StringTrimRight($hVideo.Eval("video.entry.media$group.yt$uploaded.$t"), 5), "T", " ")
EndFunc ;==>YouTube_GetUploadedFunc YouTube_GetPublished($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return StringReplace(StringTrimRight($hVideo.Eval("video.entry.published.$t"), 5), "T", " ")
EndFunc ;==>YouTube_GetPublishedFunc YouTube_GetUpdated($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return StringReplace(StringTrimRight($hVideo.Eval("video.entry.updated.$t"), 5), "T", " ")
EndFunc ;==>YouTube_GetUpdatedFunc YouTube_GetUploaderID($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.yt$uploaderId.$t")
EndFunc ;==>YouTube_GetUploaderIDFunc YouTube_GetAspectRatio($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.yt$aspectRatio.$t")
EndFunc ;==>YouTube_GetAspectRatioFunc YouTube_GetDescription($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$description.$t")
EndFunc ;==>YouTube_GetDescriptionFunc YouTube_GetAuthorName($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.author[" & $iIndex & "].name.$t")
EndFunc ;==>YouTube_GetAuthorNameFunc YouTube_GetAuthorURI($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.author[" & $iIndex & "].uri.$t")
EndFunc ;==>YouTube_GetAuthorURIFunc YouTube_GetAuthorID($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.author[" & $iIndex & "].yt$userId.$t")
EndFunc ;==>YouTube_GetAuthorIDFunc YouTube_GetThumbDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "default")
EndFunc ;==>YouTube_GetThumbDefaultFunc YouTube_GetThumbMQDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "mqdefault")
EndFunc ;==>YouTube_GetThumbMQDefaultFunc YouTube_GetThumbHQDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "hqdefault")
EndFunc ;==>YouTube_GetThumbHQDefaultFunc YouTube_GetThumbSDDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "sddefault")
EndFunc ;==>YouTube_GetThumbSDDefaultFunc YouTube_GetThumbStart($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "start")
EndFunc ;==>YouTube_GetThumbStartFunc YouTube_GetThumbMiddle($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "middle")
EndFunc ;==>YouTube_GetThumbMiddleFunc YouTube_GetThumbEnd($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "end")
EndFunc ;==>YouTube_GetThumbEndFunc YouTube_GetThumbByName($hVideo, $sName)
[/autoit] [autoit][/autoit] [autoit]
Local $iLength = $hVideo.Eval("video.entry.media$group.media$thumbnail.length") - 1
For $i = 0 To $iLength
$sYtName = $hVideo.Eval("video.entry.media$group.media$thumbnail[" & $i & "].yt$name")
If $sYtName = $sName Then ExitLoop
Next
If $i > $iLength Then Return SetError(1, 0, 0)
Return $hVideo.Eval("video.entry.media$group.media$thumbnail[" & $i & "].url")
EndFunc ;==>YouTube_GetThumbByNameFunc YouTube_GetContentFlash($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetContentByIndex($hVideo, 0)
EndFunc ;==>YouTube_GetContentFlashFunc YouTube_GetContentRTSP1($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetContentByIndex($hVideo, 1)
EndFunc ;==>YouTube_GetContentRTSP1Func YouTube_GetContentRTSP6($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetContentByIndex($hVideo, 2)
EndFunc ;==>YouTube_GetContentRTSP6Func YouTube_GetContentByIndex($hVideo, $iIndex)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$content[" & $iIndex & "].url")
EndFunc ;==>YouTube_GetContentByIndexFunc YouTube_GetCommentCount($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$comments.gd$feedLink.countHint")
EndFunc ;==>YouTube_GetCommentCountFunc YouTube_GetVID($hVideo)
[/autoit] [autoit][/autoit] [autoit][/autoit]
Return $hVideo.Eval("video.entry.media$group.yt$videoid.$t")
EndFunc ;==>YouTube_GetVIDSo!
Übrigens, die vorliegende Fehlermeldung hat sich verändert:
Line 125
(File "X:\Programmierung\Projekte\AutoIt\Youtube client\YouTubeAPI.au3"):
Func YouTube_GetTitle($hVideo)
Func YouTube_GetTitle($hVideo)^
ERROR: Unknown function name.im prinzip das gleiche, nur jetzt in der Datei YoutubeAPI.au3
Hoffendlich hab ich das jetzt richtig gemacht.
Noch was:
Ich versteh kein funken polnisch...
Ich hab nur in diesem forum eine Datei gefunden über google, und mir dann mit dem Google übersetzer weiter geholfen.
Zum glück war dann in der Datei alles auf Englisch.Also, keine sorge, ich spreche Deutsch, und ich komme auch aus Deutschland.
LG. Chris.
-
Hi!
Also:
Alle Funktionen die in youtube client.au3 definiert werden außer "YouTube_GetTitle", sind von Youtube.au3.
Ich habe die aus der youtube.au3 raus genommen, weil ich dachte dort liegt das Problem. Und die Youtube.au3 habe ich nicht includet weil ich nicht unnötige funktionen in meinem Skript wollte und weil wie schon oben erwähnt die funktionsnamen bei den beiden sich manchmal gleichen. Keine Sorge, alle Funktionen die im skript "youtube client.au3" definiert werden, haben auch die anderen Funktionen zuverfügung die sie brauchen.
Das mit dem _ ändert nichts.
Die Youtube.au3 habe ich genannt, damit klar ist, woher die funktionen kommen.
Ich hoffe jetzt ist es klarer.
Aber welche Variablen sind nicht deklariert?LG. Chris.
p.s.: Sorry wegen dem Durcheinander! Da gab es ein missverständniss. Sorry... -
Ok, 1. Beitrag editiert, ich hoffe so ist es besser.
Das komma ist ausversehn bei der übertragung passiert, dass war nicht der Fehler, aber danke!LG. Chris.
-
Hi!
Ich bin neu in diesem Forum, und hab gleich eine Frage:
Ich schreibe gerade für mich privat ein Youtube client.
Dafür habe ich mir aus dem Internet ein paar UDF's besorgt. Bei ein paar funktioniert das mit objekten, aber dort kenn ich mich nicht sonderlich aus, da ich noch kein tutorial dazu gefunden habe.
Nun zu meinem problem:
Hier erst einmal die Programm-Codes.
Vor ab, der unten genannter Fehler tritt auch auf wenn ich das aus der orginal datei nähmlich:
youtubeAPI.au3
include, und es tritt auch auf wenn die Funktionen am ende des Skriptes stehen.
Hier also der Code von youtube client.au3:Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <IE.au3>
#include "YouTubeAPI.au3"
#include <INet.au3>Global $oCollection
[/autoit] [autoit][/autoit] [autoit]
Func _Youtube_Read($iID)$sSource = _INetGetSource('http://youtube.com/watch?v='&$iID)
[/autoit] [autoit][/autoit] [autoit]Return $sSource
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _Youtube_Create($iX, $iY, $iWidth=$YT_DEFAULTWIDTH, $iHeight=$YT_DEFAULTHEIGHT)
[/autoit] [autoit][/autoit] [autoit]Local $aReturn[2]
[/autoit] [autoit][/autoit] [autoit]$oIE = _IECreateEmbedded()
[/autoit] [autoit][/autoit] [autoit]
$hObj = GUICtrlCreateObj($oIE, $iX, $iY, $iWidth, $iHeight)_IENavigate ($oIE, "about:blank", 0)
[/autoit] [autoit][/autoit] [autoit]
_IEDocWriteHTML($oIE, '<body bgcolor="Black"></body>')$aReturn[0] = $oIE
[/autoit] [autoit][/autoit] [autoit]
$aReturn[1] = $hObjReturn $aReturn
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _Youtube_Load($aPlayerControl, $sPlayer, $iAutoPlay=True)
[/autoit] [autoit][/autoit] [autoit]If $iAutoPlay Then
[/autoit] [autoit][/autoit] [autoit]
$sURL = _Youtube_GetPlayerLink($sPlayer)
Else
$sURL = _Youtube_GetEmbedLink($sPlayer)
EndIf_IENavigate ($aPlayerControl[0], $sURL, 0)
[/autoit] [autoit][/autoit] [autoit]Return 1
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _Youtube_Stop($aPlayerControl)
[/autoit] [autoit][/autoit] [autoit]_IENavigate ($aPlayerControl[0], "about:blank", 0)
[/autoit] [autoit][/autoit] [autoit]
_IEDocWriteHTML($aPlayerControl[0], '<body bgcolor="Black"></body>')EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func YouTube_GetTitle($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$title.$t")
EndFunc$oIE = _IECreateEmbedded()
[/autoit] [autoit][/autoit] [autoit]
$formMain = GUICreate("YouTube Client", 418, 466, 192, 164)
$oFlash = ObjCreate("ShockwaveFlash.ShockwaveFlash.11")
$objPlayer = GUICtrlCreateObj($oFlash, 8, 40, 489, 393)$inpWord = GUICtrlCreateInput("test", 8, 8, 321, 21)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($inpWord, $GUI_FOCUS) ; Der Fokus ist auf diesem Element
$btnSearch = GUICtrlCreateButton("Suche", 330, 7, 81, 23)
$lswResults = GUICtrlCreateListView("Titel | Länge", 8, 32, 401, 393)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 320)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 60)
$btnPlay = GUICtrlCreateButton("Wiedergabe", 8, 432, 401, 25)Dim $aItems[200]
[/autoit] [autoit][/autoit] [autoit]
Dim $aVID[20]GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $btnSearch
For $i = 0 To 19
GUICtrlDelete($aItems[$i])
Next
$oCollection = YouTube_SearchVideos(GUICtrlRead($inpWord), 20, 1, $YT_BY_VIEWS, $YT_LANG_GERMAN)
For $i = 0 To YouTube_GetVideosCount($oCollection) - 1
YouTube_SelectIndex($oCollection, $i)
$aItems[$i] = GUICtrlCreateListViewItem(StringReplace(YouTube_GetTitle($oCollection), "|", "") & "|" & ToMinutes(YouTube_GetDuration($oCollection)), $lswResults)
$aVID[$i] = YouTube_GetVID($oCollection) ;
Next
Case $btnPlay
For $i = 0 To 199
If GUICtrlRead($lswResults) = $aItems[$i] Then ExitLoop
Next
$vidio_title = YouTube_GetTitle($oCollection)
$form_player = GUICreate($vidio_title, 600, 600, 100, 200)YouTube_SelectIndex($oCollection, $i) ; Wählt das aktive Objekt in der Sammlung
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$vidio_id = YouTube_GetVID($oCollection)$a_youtubeplayer = _Youtube_Create(120, 220)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
GUISetState(@SW_SHOW)
$vidio_load_process = _Youtube_Load($a_youtubeplayer, $youtube_source)
GUICtrlSetState($a_youtubeplayer, $GUI_FOCUS) ; Der Fokus ist auf diesem ButtonWhile True
[/autoit] [autoit][/autoit] [autoit]
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $GUI_EVENT_CLOSE
_Youtube_Stop($a_youtubeplayer)
GUIDelete()
EndSwitch
WEndEndSwitch
[/autoit]
WEndDas ist der Code von dem Client.
Hier jetzt der Code von YoutubeAPI.au3:Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
; #INCLUDE# ====================================================================================================================
; Name ..........: YouTubeAPI
; Author ........: PunisherAxe
; Version .......: 1.2
; ===============================================================================================================================Global Const $YT_BY_RELEVANCE = "relevance"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_BY_VIEWS = "viewCount"
Global Const $YT_BY_PUBLISHED = "published"
Global Const $YT_BY_RATING = "rating"Global Const $YT_TIME_HOUR = "hour"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_TIME_TODAY = "today"
Global Const $YT_TIME_WEEK = "this_week"
Global Const $YT_TIME_MONTH = "this_month"
Global Const $YT_TIME_YEAR = "year"
Global Const $YT_TIME_ALL = "time_all"Global Const $YT_LANG_POLISH = "pl"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_LANG_ENGLISH = "en"
Global Const $YT_LANG_GERMAN = "de"Global Const $YT_DURATION_SHORT = "short"
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_DURATION_MEDIUM = "medium"
Global Const $YT_DURATION_LONG = "long"Global Const $YT_CAPTION_TRUE = True
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_CAPTION_FALSE = FalseGlobal Const $YT_HD_TRUE = True
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_HD_FALSE = FalseFunc YouTube_GetVIDFromURL($sWatch)
[/autoit] [autoit][/autoit] [autoit]
Local $aResults = StringRegExp($sWatch, "(|\?|&)v=([\w|\-]+)", 3)
If Not IsArray($aResults) Then Return SetError(1, 0, 0)
Return $aResults[1]
EndFunc ;==>YouTube_GetVIDFromURLFunc YouTube_GetVideo($sVID)
[/autoit] [autoit][/autoit] [autoit]
Local $sResults, $sURL, $oVideo, $oHTTP
$sURL = "http://gdata.youtube.com/feeds/api/videos/" & $sVID & "?v=2&alt=json"
$oVideo = ObjCreate("ScriptControl")
$oVideo.language = "JScript"
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $sURL)
;$oHTTP.SetRequestHeader("Content-Type", "application/json; charset=utf-8")
$oHTTP.Send()
$oHTTP.WaitForResponse()
$sResults = $oHTTP.ResponseText
$oVideo.Eval("var video = (" & $sResults & ");")
If StringLeft($sResults, 6) == "<error" Then Return SetError(1, 0, 0)
Return $oVideo
EndFunc ;==>YouTube_GetVideoFunc YouTube_SearchVideos($sQuestion, $iMaxResults = 10, $iStartIndex = 1, $sOrderBy = $YT_BY_RELEVANCE, $sLang = "", $sCategory = "", $sAuthor = "", $sDuration = "", $sTime = "", $bHD = "", $bCaption = "")
[/autoit] [autoit][/autoit] [autoit]
Local $sResults, $sURL, $oVideo, $oHTTP
If $sLang <> "" Then $sLang = "&lr=" & $sLang
If $sCategory <> "" Then $sCategory = "&category=" & $sCategory
If $sAuthor <> "" Then $sAuthor = "&author=" & $sAuthor
If $sDuration <> "" Then $sDuration = "&duration=" & $sDuration
If $sTime <> "" Then $sTime = "&time=" & $sTime
If $bHD <> "" Then
If $bHD = True Then
$bHD = "&hd=true"
Else
$bHD = "&hd=false"
EndIf
EndIf
If $bCaption <> "" Then
If $bCaption = True Then
$bCaption = "&caption"
Else
$bCaption = ""
EndIf
EndIf
$sURL = "https://gdata.youtube.com/feeds/api/videos?q=" & $sQuestion & "&orderby=" & $sOrderBy & "&start-index=" & $iStartIndex & "&max-results=" & $iMaxResults & $bHD & $sDuration & $sAuthor & $sCategory & $sTime & "&v=2&alt=json"
$oVideo = ObjCreate("ScriptControl")
$oVideo.language = "JScript"
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $sURL)
$oHTTP.Send()
$oHTTP.WaitForResponse()
$sResults = $oHTTP.ResponseText
$oVideo.Eval("var collection = (" & $sResults & ");")
If StringLeft($sResults, 6) == "<error" Then Return SetError(1, 0, 0)
Return $oVideo
EndFunc ;==>YouTube_SearchVideosFunc YouTube_SelectIndex(ByRef $oCollection, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
$oCollection.Eval('var video = {"entry" : collection.feed.entry[' & $iIndex & ']};')
EndFunc ;==>YouTube_SelectIndexFunc YouTube_GetVideosCount($oCollection)
[/autoit] [autoit][/autoit] [autoit]
Return $oCollection.Eval("collection.feed.entry.length")
EndFunc ;==>YouTube_GetVideosCountFunc YouTube_GetLikes($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.yt$rating.numLikes")
EndFunc ;==>YouTube_GetLikesFunc YouTube_GetDislikes($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.yt$rating.numDislikes")
EndFunc ;==>YouTube_GetDislikesFunc YouTube_GetViews($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.yt$statistics.viewCount")
EndFunc ;==>YouTube_GetViewsFunc YouTube_GetRaters($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.numRaters")
EndFunc ;==>YouTube_GetRatersFunc YouTube_GetAverageRating($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.average")
EndFunc ;==>YouTube_GetAverageRatingFunc YouTube_GetMaxRating($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.max")
EndFunc ;==>YouTube_GetMaxRatingFunc YouTube_GetMinRating($hVideo)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$rating.min")
EndFunc ;==>YouTube_GetMinRatingFunc YouTube_GetCategory($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$category[" & $iIndex & "].$t")
EndFunc ;==>YouTube_GetCategoryFunc YouTube_GetDuration($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.yt$duration.seconds")
EndFunc ;==>YouTube_GetDurationFunc YouTube_GetUploaded($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return StringReplace(StringTrimRight($hVideo.Eval("video.entry.media$group.yt$uploaded.$t"), 5), "T", " ")
EndFunc ;==>YouTube_GetUploadedFunc YouTube_GetPublished($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return StringReplace(StringTrimRight($hVideo.Eval("video.entry.published.$t"), 5), "T", " ")
EndFunc ;==>YouTube_GetPublishedFunc YouTube_GetUpdated($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return StringReplace(StringTrimRight($hVideo.Eval("video.entry.updated.$t"), 5), "T", " ")
EndFunc ;==>YouTube_GetUpdatedFunc YouTube_GetUploaderID($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.yt$uploaderId.$t")
EndFunc ;==>YouTube_GetUploaderIDFunc YouTube_GetAspectRatio($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.yt$aspectRatio.$t")
EndFunc ;==>YouTube_GetAspectRatioFunc YouTube_GetDescription($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$description.$t")
EndFunc ;==>YouTube_GetDescriptionFunc YouTube_GetAuthorName($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.author[" & $iIndex & "].name.$t")
EndFunc ;==>YouTube_GetAuthorNameFunc YouTube_GetAuthorURI($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.author[" & $iIndex & "].uri.$t")
EndFunc ;==>YouTube_GetAuthorURIFunc YouTube_GetAuthorID($hVideo, $iIndex = 0)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.author[" & $iIndex & "].yt$userId.$t")
EndFunc ;==>YouTube_GetAuthorIDFunc YouTube_GetThumbDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "default")
EndFunc ;==>YouTube_GetThumbDefaultFunc YouTube_GetThumbMQDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "mqdefault")
EndFunc ;==>YouTube_GetThumbMQDefaultFunc YouTube_GetThumbHQDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "hqdefault")
EndFunc ;==>YouTube_GetThumbHQDefaultFunc YouTube_GetThumbSDDefault($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "sddefault")
EndFunc ;==>YouTube_GetThumbSDDefaultFunc YouTube_GetThumbStart($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "start")
EndFunc ;==>YouTube_GetThumbStartFunc YouTube_GetThumbMiddle($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "middle")
EndFunc ;==>YouTube_GetThumbMiddleFunc YouTube_GetThumbEnd($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetThumbByName($hVideo, "end")
EndFunc ;==>YouTube_GetThumbEndFunc YouTube_GetThumbByName($hVideo, $sName)
[/autoit] [autoit][/autoit] [autoit]
Local $iLength = $hVideo.Eval("video.entry.media$group.media$thumbnail.length") - 1
For $i = 0 To $iLength
$sYtName = $hVideo.Eval("video.entry.media$group.media$thumbnail[" & $i & "].yt$name")
If $sYtName = $sName Then ExitLoop
Next
If $i > $iLength Then Return SetError(1, 0, 0)
Return $hVideo.Eval("video.entry.media$group.media$thumbnail[" & $i & "].url")
EndFunc ;==>YouTube_GetThumbByNameFunc YouTube_GetContentFlash($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetContentByIndex($hVideo, 0)
EndFunc ;==>YouTube_GetContentFlashFunc YouTube_GetContentRTSP1($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetContentByIndex($hVideo, 1)
EndFunc ;==>YouTube_GetContentRTSP1Func YouTube_GetContentRTSP6($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return YouTube_GetContentByIndex($hVideo, 2)
EndFunc ;==>YouTube_GetContentRTSP6Func YouTube_GetContentByIndex($hVideo, $iIndex)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.media$group.media$content[" & $iIndex & "].url")
EndFunc ;==>YouTube_GetContentByIndexFunc YouTube_GetCommentCount($hVideo)
[/autoit] [autoit][/autoit] [autoit]
Return $hVideo.Eval("video.entry.gd$comments.gd$feedLink.countHint")
EndFunc ;==>YouTube_GetCommentCountFunc YouTube_GetVID($hVideo)
[/autoit] [autoit][/autoit] [autoit][/autoit]
Return $hVideo.Eval("video.entry.media$group.yt$videoid.$t")
EndFunc ;==>YouTube_GetVIDUnd zuletzt der Code von Youtube.au3:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#cs ----------------------------------------------------------------------------AutoIt Version: 3.2.13.3 (beta)
[/autoit] [autoit][/autoit] [autoit]
Author: myNameScript Function:
[/autoit] [autoit][/autoit] [autoit]
Template AutoIt script.#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]; Script Start - Add your code below here
[/autoit] [autoit][/autoit] [autoit]#cs
[/autoit] [autoit][/autoit] [autoit]Functions:
[/autoit] [autoit][/autoit] [autoit]_Youtube_Read($iID)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]_Youtube_GetID($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
_Youtube_GetTitle($sPlayer)
_Youtube_GetDescription($sPlayer)
_Youtube_GetKeywords($sPlayer)_Youtube_GetEmbedLink($sPlayer)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_Youtube_GetPlayerLink($sPlayer)
_Youtube_GetPlayerSwf($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
_Youtube_Create($iX, $iY, $iWidth=$YT_DEFAULTWIDTH, $iHeight=$YT_DEFAULTHEIGHT)
_Youtube_Load($aPlayerControl, $sPlayer, $iAutoPlay=True)
_Youtube_Stop($aPlayerControl)#CE
[/autoit] [autoit][/autoit] [autoit]#include-once
[/autoit] [autoit][/autoit] [autoit]
#include <INet.au3>
#include <IE.au3>Global Const $YT_DEFAULTWIDTH = 425
[/autoit] [autoit][/autoit] [autoit]
Global Const $YT_DEFAULTHEIGHT = 344; Downloads the source of the Youtube page
[/autoit] [autoit][/autoit] [autoit]
; $iID = Video ID (example: "sNzEQ8hG1zA")Func _Youtube_Read($iID)
[/autoit] [autoit][/autoit] [autoit]
$sSource = _INetGetSource('http://youtube.com/watch?v='&$iID)
Return $sSource
EndFunc; Creates a embedded IE control for playing Youtube movies
[/autoit] [autoit][/autoit] [autoit]
; $iX, $iY, $iWidth, $iHeight = Coordinates of the controlFunc _Youtube_Create($iX, $iY, $iWidth=$YT_DEFAULTWIDTH, $iHeight=$YT_DEFAULTHEIGHT)
[/autoit] [autoit][/autoit] [autoit]
Local $aReturn[2]
$oIE = _IECreateEmbedded()
$hObj = GUICtrlCreateObj($oIE, $iX, $iY, $iWidth, $iHeight)
_IENavigate ($oIE, "about:blank", 0)
_IEDocWriteHTML($oIE, '<body bgcolor="Black"></body>')
$aReturn[0] = $oIE
$aReturn[1] = $hObj
Return $aReturn
EndFunc; Loads a movie into a player control.
[/autoit] [autoit][/autoit] [autoit]
; $aPlayerControl = A player control (return value of _Youtube_Create)
; $sPlayer = A movie (return value of _Youtube_Read)
; [$iAutoPlay] = Automaticly starts playing the movie if True.Func _Youtube_Load($aPlayerControl, $sPlayer, $iAutoPlay=True)
[/autoit] [autoit][/autoit] [autoit]
If $iAutoPlay Then
$sURL = _Youtube_GetPlayerLink($sPlayer)
Else
$sURL = _Youtube_GetEmbedLink($sPlayer)
EndIf
_IENavigate ($aPlayerControl[0], $sURL, 0)
Return 1
EndFunc; Stops playing a movie
[/autoit] [autoit][/autoit] [autoit]
; $aPlayerControl = Player control (return value of _Youtube_Create)Func _Youtube_Stop($aPlayerControl)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_IENavigate ($aPlayerControl[0], "about:blank", 0)
_IEDocWriteHTML($aPlayerControl[0], '<body bgcolor="Black"></body>')
EndFuncFunc _Youtube_GetKeywords($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,'<meta name="keywords" content=')
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen('<meta name="keywords" content=')-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,'<meta name="keywords" content=')
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen('<meta name="keywords" content=')-1)
$sAfterPlayerLink = StringTrimRight($sAfterPlayerLink,2)
$sAfterPlayerLink = StringTrimLeft($sAfterPlayerLink,1)
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetEmbedLink($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var embedUrl = ")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var embedUrl = ")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var embedUrl = ")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var embedUrl = ")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,";","")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"'","")
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetID($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var pageVideoId = ")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var pageVideoId = ")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var pageVideoId = ")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var pageVideoId = ")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,";","")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"'","")
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetDescription($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,'<meta name="description" content=')
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen('<meta name="description" content=')-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,'<meta name="description" content=')
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen('<meta name="description" content=')-1)
$sAfterPlayerLink = StringTrimRight($sAfterPlayerLink,2)
$sAfterPlayerLink = StringTrimLeft($sAfterPlayerLink,1)
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetTitle($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,'<meta name="title" content=')
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen('<meta name="title" content=')-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,'<meta name="title" content=')
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen('<meta name="title" content=')-1)
$sAfterPlayerLink = StringTrimRight($sAfterPlayerLink,2)
$sAfterPlayerLink = StringTrimLeft($sAfterPlayerLink,1)
Return $sAfterPlayerLink
EndFuncFunc _Youtube_GetPlayerLink($sPlayer)
[/autoit] [autoit][/autoit] [autoit]
$sSWF = _Youtube_GetPlayerSwf($sPlayer)
If Not $sSWF Then Return ""
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var swfArgs = {")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var swfArgs = {")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var swfArgs = {")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var swfArgs = {")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"};","")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,'"',"")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,": ","=")
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,", ","&")
;$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"null","0")
Return $sSWF&"?"&$sAfterPlayerLink
EndFuncFunc _Youtube_GetPlayerSwf($sPlayer)
[/autoit]
$sSource = $sPlayer
$iPlayerLinkStart = StringInStr($sSource,"var swfUrl = ")
If Not $iPlayerLinkStart Then Return ""
$sBeforePlayerLink = StringLeft($sSource,$iPlayerLinkStart+StringLen("var swfUrl = canPlayV9Swf() ? ")-1)
If Not $sBeforePlayerLink Then Return ""
$aSplit = StringSplit($sBeforePlayerLink,@CRLF)
$iPlayerLinkLine = $aSplit[0]
If Not $iPlayerLinkLine Then Return ""
$aSourceSplit = StringSplit($sSource,@CRLF)
If $iPlayerLinkLine > $aSourceSplit[0] Then Return ""
$sPlayerLinkLine = $aSourceSplit[$iPlayerLinkLine]
$iPlayerLinkStart = StringInStr($sPlayerLinkLine,"var swfUrl = ")
$sAfterPlayerLink = StringTrimLeft($sPlayerLinkLine,$iPlayerLinkStart+StringLen("var swfUrl = canPlayV9Swf() ? ")-1)
$sAfterPlayerLink = StringReplace($sAfterPlayerLink,"'","")
$aSplit = StringSplit($sAfterPlayerLink," ")
Return $aSplit[1]
EndFunc
(Die Dateien YoutubeAPI.au3 und Youtube.au3 liegen noch im Anhang).Wenn man jetzt youtube client.au3 startet und auf Suchen klickt kommt folgendes:
Line 55
(File "X:\Programmierung\Projekte\AutoIt\Youtube client\Youtube client.au3"):
Func YouTube_GetTitle($hVideo)
Func YouTube_GetTitle($hVideo)^
ERROR: Unknown function name.Ich verstehe das nicht, warum
"ERROR: Unknown function name."
Das ist mir rätselhaft, da doch genau dort die Funktion definiert wird.Wahrscheinlich ist die lösung sehr leicht, aber ich suche schon eine ganze weile nach dem problem.
Kann mir hier jemand weiter helfen und mir auch vllt. ein tutorial nennen zur OOp mit autoit?Nur das keine unklarheiten entstehen:
YoutubeAPI.au3
ist aus einem polnischen forum und ich hab mich sehr an dem beispiel orentiert, was mit geliefert wurde.
Die anderen Funktionen sind aus
Youtube.au3, die hab ich glaub ich aus diesem Forum.
Falls mir jemand weiter helfen kann, währe das sehr schön.
Ich habe Scite und Autoit in der aktuellsten stabielen version und windows xp noch auf meinem rechner.
(32 bit)
Vielen dank in vorraus.Lg. Chris.
p.s. sorry für die formatierung, bei mir wird das ein bisschen merkwürdig angezeigt. -
Hi!
Nun, ein weiterer User hat zu euch gefunden...
Ich bin Christopher Proß und bin noch recht jung.
Ich bin ein Anfänger in Autoit, und will hier erfahrene User finden die mir weiter helfen.
Ich habe die deutsche-hilfe schon mir durchgelesen, aber da verstehe ich nur die Helfte...
Aber das gehört nicht hier her.
Ich sollte euch auch sagen, dass ich nichts sehen kann, also blind bin...
Das will ich einfach sagen, dass ier euch nicht wundert wenn ich mit "musemove" oder "pixelcollor" nichts anfangen kann...
:rowl:
Nun, genug zu mir, ich werde jetzt auf Streifzüge durch den Threats-dschungel machen...
lg. chris.
sorry für ewentuelle Rechtschreib-fehler.