UPDATE!
another dev upgraded my original script to this:
@Echo off & color 0A & Mode 95,3
Title Stream IPTV Grabber by Hackoo 2019
echo(
echo Type your favorite Channel Name for trying to catch and extract its link :
Set /p "Channel_Name="
Set "OutPut_All_Streams=%~dp0%Channel_Name%_All_Streams.txt"
Set "OutPut_Filter_Streams=%~dp0%Channel_Name%_Filter_Streams.txt"
Cls
echo(
echo Please wait a while ... trying to get all links about your favorite channel "%Channel_Name%"
REM Just to show links into console
::Call :GRAB_IPTV_STREAM_LINK "%Channel_Name%" CON
Call :GRAB_IPTV_STREAM_LINK "%Channel_Name%" "%OutPut_All_Streams%"
REM To get rid from all links that cointains m3u8 and firstonetv strings
Type "%OutPut_All_Streams%" | find /I /V "m3u8" | find /I /V "firstonetv">"%OutPut_Filter_Streams%"
::If Exist "%OutPut_All_Streams%" Start "" "%OutPut_All_Streams%"
::If Exist "%OutPut_Filter_Streams%" Start "" "%OutPut_Filter_Streams%" & Exit
Call :M3U_PlayList_Creator %Channel_Name% %OutPut_Filter_Streams%
Exit
::--------------------------------------------------------------------------------------
:GRAB_IPTV_STREAM_LINK <Channel_Name> <OutPutFile>
Set "VBSFILE=%Temp%\GrabIPTV.vbs"
(
echo SourceCode = GetSourceCode("
http://visearch.net/iptv/web?q="^& %1^)
echo Stream_Link = Extract(SourceCode^)
echo wscript.echo Stream_Link
echo '------------------------------------------------
echo Function Extract(Channel_Name^)
echo Dim regEx, Match, Matches
echo Set regEx = New RegExp
echo regEx.Pattern = "(data-url=\x22)(http.*)(\x22)"
echo regEx.IgnoreCase = True
echo regEx.Global = True
echo Set Matches = regEx.Execute(Channel_Name^)
echo For each Match in Matches
echo Stream_Link = Stream_Link ^& Match.SubMatches(1^) ^& vbCrlf
echo Next
echo Extract = Stream_Link
echo End Function
echo '------------------------------------------------
echo Function GetSourceCode(Channel_Name^)
echo Dim http
echo Set http = CreateObject("Microsoft.XMLHTTP"^)
echo http.open "GET",Channel_Name,False
echo On Error Resume Next
echo http.send
echo If Err.Number = 0 Then
echo If http.Status = "200" Then
echo GetSourceCode = http.ResponseText
echo Else
echo GetSourceCode = "HTTP " ^& http.Status ^& " " ^& _
echo http.StatusText
echo End If
echo Else
echo GetSourceCode = "Error " ^& Err.Number ^& " " ^& Err.Source ^& " " ^& _
echo Err.Description
echo End If
echo On Error GoTo 0
echo End Function
echo '------------------------------------------------
)>"%VBSFILE%"
Cscript //NoLogo "%VBSFILE%" > "%~2"
If Exist "%VBSFILE%" Del "%VBSFILE%"
Exit /b
::--------------------------------------------------------------------------------------
:M3U_PlayList_Creator <Channel_Name> <InputFile>
echo #EXTM3U>"%~n2.m3u"
set /a "N=0"
SetLocal EnableDelayedExpansion
@for /f "delims=" %%a in ('Type %2') do (
Set /a N+=1
(
echo #EXTINF:-1,!N!-%1
echo %%a
)>>"%~n2.m3u"
)
If Exist "%~n2.m3u" Start "" "%~n2.m3u"
Exit /b
::--------------------------------------------------------------------------------------