Background - I'm trying to bulk download some videos from a website. I have all the links and while I can manually open the .bat file and paste the link (and repeat), I was wondering if there is a way to automate this so I could perhaps paste the set of links I have and either have it download continuously (so finish one and move on to the next) or any other automated way?
Here is the current script in the .bat file --
@ echo off
call set /p link=paste the link:
rem call set folder="%~dp0\videos\\"
set folder=M:\\Voot
If Not Exist %folder% MD %folder%
rem call set /p quality=write quality (write low medium or high):
Set quality=high
call set livestreamer="%~dp0\tools\livestreamer\\"
call "%~dp0\tools\php5.4\php.exe" voot.php "%%link%%" "%%folder%%" "%%livestreamer%%" "%%quality%%"
:end1
pause
:end
Here are three links from the site:
http://www.voot.com/shows/naagin/1/359115/yaminis-truth-is-revealed/393087
http://www.voot.com/shows/naagin/1/359115/sesha-cohorts-with-yamini/393813
http://www.voot.com/shows/naagin/1/359115/the-saviour/389235
Answer
I was wondering if there is a way to automate this
The easiest way to automate this is to save the links in a file and then use for /f
to process the links file.
Use the following batch file (links.cmd):
@echo off
setlocal enabledelayedexpansion
set "folder=M:\\Voot"
if not exist %folder% md %folder%
set quality=high
set livestreamer="%~dp0\tools\livestreamer\\"
for /f "usebackq tokens=*" %%i in (`type links.txt`) do (
echo "%~dp0\tools\php5.4\php.exe" voot.php "%%i" "%folder%" "%livestreamer%" "%quality%"
)
endlocal
Notes:
- The links are read from a file in the same directory as the batch file, called
links.txt
- Remove the final
echo
in the file when you are happy that thephp
command is run with the correct parameters. - You only need to use
%%
with thefor
parameter, for example%%folder%%
can be replaced with%folder%
Example usage:
F:\test>type links.txt
http://www.voot.com/shows/naagin/1/359115/yaminis-truth-is-revealed/393087
http://www.voot.com/shows/naagin/1/359115/sesha-cohorts-with-yamini/393813
http://www.voot.com/shows/naagin/1/359115/the-saviour/389235
F:\test>links
"F:\test\\tools\php5.4\php.exe" voot.php "http://www.voot.com/shows/naagin/1/359115/yaminis-truth-is-revealed/393087" "M:\\Voot" ""F:\test\\tools\livestreamer\\"" "high"
"F:\test\\tools\php5.4\php.exe" voot.php "http://www.voot.com/shows/naagin/1/359115/sesha-cohorts-with-yamini/393813" "M:\\Voot" ""F:\test\\tools\livestreamer\\"" "high"
"F:\test\\tools\php5.4\php.exe" voot.php "http://www.voot.com/shows/naagin/1/359115/the-saviour/389235" "M:\\Voot" ""F:\test\\tools\livestreamer\\"" "high"
Comments
Post a Comment