Option Explicit
Dim Title,URLArray,URL,ws,Msg,Data
Title = "Audio and Video Stream Checker"
Call ForceCScriptExecution(Title)
URLArray = Array("[URL unfurl="true"]https://5ac31d8a4c9af.streamlock.net/saheltv/_definst_/myStream/chunklist_w956788169.m3u8"_[/URL]
,"[URL unfurl="true"]http://aska.ru-hoster.com:8053/autodj"_[/URL]
,"[URL unfurl="true"]http://www.chocradios.ch/djbuzzradio_windows.mp3.asx")[/URL]
For Each URL in URLArray
wscript.echo URL & vbCrlf & CheckOnline(URL) & vbCrlf & String(100,"-")
Next
'----------------------------------------------------
Function CheckOnline(URL)
On Error Resume Next
Const WHR_EnableRedirects = 6
Dim h,AllResponseHeaders
Set h = CreateObject("WinHttp.WinHttpRequest.5.1")
h.Option(WHR_EnableRedirects) = False 'disable redirects
h.Open "HEAD", URL , False
h.Send()
AllResponseHeaders = h.GetAllResponseHeaders()
wscript.echo AllResponseHeaders
If Err.number = 0 Then
wscript.echo "STATUS : "& CInt(h.status) & vbTab & h.statusText
Select Case CInt(h.status)
Case 200,201,202,204
CheckOnline = "ONLINE"
Case 404,401,412,415,500,501,500,501
CheckOnline = "OFFLINE" & vbCrlf & h.status & " " & h.statusText
Case Else
CheckOnline = "OFFLINE" & vbCrlf & h.status & " " & h.statusText
End Select
Else
CheckOnline = "OFFLINE" & vbCrlf &_
"Error Description: " & Err.Description
On Error Goto 0
End IF
End Function
'----------------------------------------------------
Sub ForceCScriptExecution(Title)
Dim Arg, Str, cmd
cmd = "CMD /K Title " & Title &" & color 0A & "
If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then
For Each Arg In WScript.Arguments
If InStr( Arg, " " ) Then Arg = """" & Arg & """"
Str = Str & " " & Arg
Next
CreateObject( "WScript.Shell" ).Run _
cmd & "cscript //nologo """ & _
WScript.ScriptFullName & _
""" " & Str
WScript.Quit
End If
End Sub
'--------------------------------------------------