@echo off
setlocal EnableDelayedExpansion
title YouNow video downloader v1.0
echo +--------------------------------------------+
echo ^| YouNow video downloader v1.0 ^|
echo +--------------------------------------------+
echo ^| This script helps you download ^|
echo ^| YouNow.com broadcasts and live streams ^|
echo +--------------------------------------------+
echo ^| Made by @nikisdro [ 2015-07-25 ] ^|
echo +--------------------------------------------+
echo.
echo Paste broadcast URL or username below (right click - Paste) and press Enter
echo.
echo Example 1: https://www.younow.com/d10nne_
echo.
echo Example 2: d10nne_
if exist "_temp" (
rd /s /q _temp 2>NUL
md _temp 2>NUL
) else md _temp
if not exist "videos" md videos
cd _bin
set num1=1
set num2=1
:begin
set start=0
echo.
echo URL or username (leave blank to quit):
set /p url= || goto end
echo.
set url_="%url%"
if not %url_:younow.com=% == %url_% (
goto normal
) else (
goto username
)
:normal
for /f "tokens=3,4,5 delims=/" %%a in ("%url%") do (
set user=%%a
set broadcast_id=%%b
set user_id=%%c
)
start /min down.bat %user% %user_id% %broadcast_id% b%num1%
echo - OK^^! Started downloading in a separate window.
set /a num1+=1
goto begin
:username
wget -q http://www.younow.com/php/api/broadcast/info/user=%url% -O ../_temp/%url%.txt
for /f %%a in ('xidel -q ../_temp/%url%.txt -e "($json).userId"') do set user_id=%%a
for /f %%a in ('xidel -q ../_temp/%url%.txt -e "($json).errorCode"') do set error=%%a
if %error%==0 (
goto live
) else (
goto list
)
:live
set input=
set /p input="[LIVE] %url% is broadcasting now^! Start recording (y/n)? "
if "%input%"=="" (
del /q "../_temp/%url%*.txt" 2>NUL
goto begin
)
if "%input%"=="y" (
goto liveyes
) else (
goto list
)
:liveyes
for /f %%a in ('xidel -q ../_temp/%url%.txt -e "($json).broadcastId"') do set broadcast_id=%%a
start /min live.bat %url% %user_id% %broadcast_id%
echo.
echo - OK^^! Started recording in a separate window.
goto continue
:list
wget -q http://www.younow.com/php/api/post/getBroadcasts/startFrom=%start%/channelId=%user_id% -O ../_temp/%url%_json.txt
xidel -q -e '($json).posts().media.broadcast/join((videoAvailable,broadcastId,broadcastLengthMin,ddateAired),"-")' ../_temp/%url%_json.txt>../_temp/%url%_list.txt
set idx=1
set videos=
set all=
echo You can download these broadcasts:
echo.
for /f "tokens=1,2,3,4 delims=-" %%a in (../_temp/%url%_list.txt) do (
if %%a==1 (
echo !idx!. %%d [%%c]
set videos[!idx!]=%%b
set all=!all!!idx!,
)
set /a idx+=1
)
if "%all%"=="" (
echo - There's nothing to show.
del /q "../_temp/%url%*.txt" 2>NUL
goto begin
)
set input=
echo.
echo Type comma separated numbers, "all" to download everything,
set /p input=""n" to list next 10 broadcasts or leave blank to return: "
if "%input%"=="" (
del /q "../_temp/%url%*.txt" 2>NUL
goto begin
)
if "%input%"=="n" (
set /a start+=10
echo.
goto list
)
if "%input%"=="all" (
set input=%all%
)
echo.
for %%a in (%input%) do (
start /min down.bat %url% %user_id% !videos[%%a]! !num2!
echo - OK^^! Started downloading in a separate window.
set /a num2+=1
)
:continue
set input=
echo.
set /p input="Continue working with %url% (y/n)? "
if "%input%"=="y" (
echo.
goto list
) else (
del /q "../_temp/%url%*.txt" 2>NUL
goto begin
)
:end
echo.
pause