Page 1 of 1


Posted: 13 Dec 2019 20:18
by tea
Any testers out there for my iptv channel grabber program? Or how to fix it up. First batch program.

you need VLC

@ECHO ******** FIND MY STREAM ********
@echo off
::SETLOCAL DisableDelayedExpansion
:FOR /F "usebackq delims=" %%a in (`"findstr /n ^^ C:\Users\laptop\Desktop\us.txt"`) do (
:: set "var=%%a"
:: SETLOCAL EnableDelayedExpansion
:: set "var=!var:*:=!"
:: echo(!var!
ECHO Type in a TV channel.

ECHO -------------------------------------------------------
set "input1="
set /p"input1="

SETLOCAL EnableExtensions EnableDelayedExpansion
set "chromepath=c:\Program Files (x86)\Google\Chrome\Application" path to chrome
set "site="
set "site2="
set "engine=?q"
start "" !site!/!engine!=!input1!"
setlocal enableExtensions enableDelayedExpansion
:: uri encoded input of form:<username>/<password>/30356
set "input="
ECHO ---------------------------

ECHO Outputs that have .m3u8 extenstions will be rejected.
ECHO If this happens select a new channel from web page then paste.

ECHO Paste from Website channel URL
set /p "input="
if not "x%input:u8=%" == "x%input%" goto :pass
echo Options;
echo 1 : View channel on VLC
echo 2 : Full account channel list -download list-
echo 3 : Check account status
echo 4 : Add to playlist
echo 5 : If stream fails .Paste new channel
echo 6 : If you want a new channel select this option to Enter Another channel
:: Prompt for input,
set /p "strMenu=Enter desired number:"

:: Compare input through if commands,
:: `if not defined strMenu goto :menu` can be used here if prefered.
echo %strMenu%
if "%strMenu%" equ "1" goto vlc
if "%strMenu%" equ "2" goto CL
if "%strMenu%" equ "3" goto CS
if "%strMenu%" equ "4" goto ML
if "%strMenu%" equ "5" goto pass
if "%strMenu%" equ "6" goto start
::Set "LogFile=C:\Users\laptop\Desktop\test.txt"
start "" "C:\Program Files\VideoLAN\VLC\vlc.exe" !input! :sout=#display :sout-all :sout-keep
goto main
:: variables of form
:: "%%~a" = "http:"
:: "%%~b" = ""
:: "%%~c" = "<username>"
:: "%%~d" = "<password>"
:: "%%~e" = "30356"
:: output of form< ... .&type=m3u
set "output="
for /f "tokens=1-5 delims=/" %%a in ("!input!") do (
set "output=%%~a//%%~b/get.php?username=%%~c&password=%%~d&type=m3u"
start "" !output!
goto main
echo #EXTINF:-1, %input1%>> TV.M3U
echo %input%>> TV.M3U

goto main
Echo Web page opens go to bottom of page and paste in last field.
@echo off
et "output="
for /f "tokens=1-5 delims=/" %%a in ("!input!") do (
set "output=%%~a//%%~b/get.php?username=%%~c&password=%%~d&type=m3u"

cmd /E:ON /V:ON /cecho(!output!
@echo off

start "" !site2!

goto main
echo off
goto :eof

Re: tv

Posted: 19 Dec 2019 01:47
by Hackoo
I have tested it and it worked like a charm for me :wink: :D
Thank you for this nice share bro :wink:

Re: tv

Posted: 21 Dec 2019 04:37
by Hackoo
Hi :wink:
Can you please try my draft version and tell me if this script will work or not on your side ?
All your comments are welcomed to improve it :lol:
Thank you !

Code: Select all

@echo off & color 0A & Mode 95,3
Title Stream IPTV Grabber by Hackoo 2019
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"
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% 
:GRAB_IPTV_STREAM_LINK <Channel_Name> <OutPutFile>
Set "VBSFILE=%Temp%\GrabIPTV.vbs"
	echo SourceCode = GetSourceCode(""^& %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 "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 '------------------------------------------------
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
If Exist "%~n2.m3u" Start "" "%~n2.m3u"
Exit /b 

Re: tv

Posted: 24 Dec 2019 00:54
by tea
That looks good, if I have some time I can see what I can do.

Re: tv

Posted: 24 Dec 2019 01:02
by tea
I've found some dead links from searches how can we remove them from the final output? How hard would it be to disallow mp4 as well?
You did an awesome job Hackoo!