; Spielzeit eines Youtube-Videos ermitteln :
; ------------------------------------------
; Beispiel : Pink Floyd - Animals 1977 Full Album HQ
; URL = https://www.youtube.com/watch?v=GkmADVP7M8Q
; erstes Vorkommen von "title":"[Titel]","
; erstes Vorkommen von "length_seconds":"[Sek -1]","

#include <Inet.au3>
#include <Array.au3>
#include <String.au3>

Global $sUrl    = "https://www.youtube.com/watch?v=GkmADVP7M8Q"
Global $sSource = "", $sTitle = "", $iPlaytime  = 0, $aArray

$sSource = _INetGetSource($sUrl, True)

; Titel ermitteln :
$aArray = _StringBetween($sSource, '"title":"', '","')
If @error Then Exit
If IsArray($aArray) Then $sTitle = $aArray[0]

; Spieldauer (in Sekunden) ermitteln :
$aArray = _StringBetween($sSource, '"length_seconds":"', '","')
If @error Then Exit
If IsArray($aArray) Then $iPlaytime = Number($aArray[0]) - 1

MsgBox(0, "Dateiinfos : ", "Titel      = " & $sTitle & @CRLF & _
                           "Spieldauer = " & SecondsToTime($iPlaytime) & @CRLF)

; Hilfsfunktion : Sekunden in Std:Min:Sek umrechnen
Func SecondsToTime($iTime)
	Local $iSec  = Mod($iTime, 60)
	Local $iMin  = Mod(Int($iTime / 60), 60)
	Local $iHour = Int($iTime / 60 ^ 2)
	Return StringFormat("%02i:%02i:%02i", $iHour, $iMin, $iSec)
EndFunc ;==>SecondsToTime