Hi Guys
Im not sure if Im in the right site or not.
Im looking for a batch program to automate a url link that changes.
I have this url format that does not change http://name.com:8080/username/password/30356
and need to have this format:http://name.com:8080/get.php?username=u ... d&type=gif
The 30356 is not needed.
Is there any kind of batch program that I can paste ----http://name.com:8080/username/password/30356 at a prompt and have an output of
http://name.com:8080/get.php?username=u ... d&type=gif
Thank you for your time
Batch program to add text to url
Moderator: DosItHelp
Re: Batch program to add text to url
This might help you:
penpen
Code: Select all
@echo off
setlocal enableExtensions enableDelayedExpansion
:: uri encoded input of form: http://name.com:8080/<username>/<password>/30356
set "input="
set /p "input="
:: variables of form
:: "%%~a" = "http:"
:: "%%~b" = "name.com:8080"
:: "%%~c" = "<username>"
:: "%%~d" = "<password>"
:: "%%~e" = "30356"
:: output of form http://name.com:8080/get.php?username=<username>&password=<password>&...&type=gif
set "output="
for /f "tokens=1-5 delims=/" %%a in ("!input!") do (
set "output=%%~a//%%~b/get.php?username=%%~c&password=%%~d&...&type=gif"
)
echo(!output!
goto :eof
Re: Batch program to add text to url
Thank you wow
You don't know how long I was trying just to make the batch just print a "&" symbol .....
The program works as advertised.
Is it possible to put the output to the clipboard?
Thank you again
Tea
You don't know how long I was trying just to make the batch just print a "&" symbol .....
The program works as advertised.
Is it possible to put the output to the clipboard?
Thank you again
Tea
Re: Batch program to add text to url
The tool clip.exe could be used for that:
penpen
Code: Select all
@echo off
setlocal enableExtensions enableDelayedExpansion
:: uri encoded input of form: http://name.com:8080/<username>/<password>/30356
set "input="
set /p "input="
:: variables of form
:: "%%~a" = "http:"
:: "%%~b" = "name.com:8080"
:: "%%~c" = "<username>"
:: "%%~d" = "<password>"
:: "%%~e" = "30356"
:: output of form http://name.com:8080/get.php?username=<username>&password=<password>&...&type=gif
set "output="
for /f "tokens=1-5 delims=/" %%a in ("!input!") do (
set "output=%%~a//%%~b/get.php?username=%%~c&password=%%~d&...&type=gif"
@(
cmd /E:ON /V:ON /cecho(!output!
)|clip
)
goto :eof
Re: Batch program to add text to url
Any thoughts on my live tv program?
:start
cls
@ECHO ******** FIND MY STREAM ********
@ECHO OFF >NUL
@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!
:: ENDLOCAL
::)
ECHO Type in a TV channel.
ECHO -------------------------------------------------------
ECHO ENTER CHANNEL TO SEARCH
set "input1="
set /p"input1="
SETLOCAL EnableExtensions EnableDelayedExpansion
set "chromepath=c:\Program Files (x86)\Google\Chrome\Application" path to chrome
set "site=http://visearch.net/iptv/web"
set "site2=https://iptvextreme.eu/"
set "engine=?q"
start "" !site!/!engine!=!input1!"
setlocal enableExtensions enableDelayedExpansion
:: uri encoded input of form: http://name.com:8080/<username>/<password>/30356
:pass
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
:main
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
pause
::Set "LogFile=C:\Users\laptop\Desktop\test.txt"
:vlc
start "" "C:\Program Files\VideoLAN\VLC\vlc.exe" !input! :sout=#display :sout-all :sout-keep
goto main
:CL
:: variables of form
:: "%%~a" = "http:"
:: "%%~b" = "name.com:8080"
:: "%%~c" = "<username>"
:: "%%~d" = "<password>"
:: "%%~e" = "30356"
:: output of form http://name.com:8080/get.php?username=< ... .&type=gif
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
:ML
echo #EXTINF:-1, %input1%>> TV.M3U
echo %input%>> TV.M3U
goto main
:CS
Echo Web page opens go to bottom of page and paste in last field.
pause
@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"
)
echo(!output!
@(
cmd /E:ON /V:ON /cecho(!output!
)|clip
@echo off
start "" !site2!
cls
goto main
echo off
goto :eof
:start
cls
@ECHO ******** FIND MY STREAM ********
@ECHO OFF >NUL
@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!
:: ENDLOCAL
::)
ECHO Type in a TV channel.
ECHO -------------------------------------------------------
ECHO ENTER CHANNEL TO SEARCH
set "input1="
set /p"input1="
SETLOCAL EnableExtensions EnableDelayedExpansion
set "chromepath=c:\Program Files (x86)\Google\Chrome\Application" path to chrome
set "site=http://visearch.net/iptv/web"
set "site2=https://iptvextreme.eu/"
set "engine=?q"
start "" !site!/!engine!=!input1!"
setlocal enableExtensions enableDelayedExpansion
:: uri encoded input of form: http://name.com:8080/<username>/<password>/30356
:pass
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
:main
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
pause
::Set "LogFile=C:\Users\laptop\Desktop\test.txt"
:vlc
start "" "C:\Program Files\VideoLAN\VLC\vlc.exe" !input! :sout=#display :sout-all :sout-keep
goto main
:CL
:: variables of form
:: "%%~a" = "http:"
:: "%%~b" = "name.com:8080"
:: "%%~c" = "<username>"
:: "%%~d" = "<password>"
:: "%%~e" = "30356"
:: output of form http://name.com:8080/get.php?username=< ... .&type=gif
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
:ML
echo #EXTINF:-1, %input1%>> TV.M3U
echo %input%>> TV.M3U
goto main
:CS
Echo Web page opens go to bottom of page and paste in last field.
pause
@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"
)
echo(!output!
@(
cmd /E:ON /V:ON /cecho(!output!
)|clip
@echo off
start "" !site2!
cls
goto main
echo off
goto :eof