–2020年11月27日追記–
※現在radiko.jpの仕様変更で下記の記事は実行できません。
前回の記事で実際に一括ダウンロードしてみたので記事を書いたがその後毎日いつ実行してもいい状況を想定して改良修正したのでここに記事にしたい
AYTHKeyGet.vbsの導入は前回の記事を参考にしてください。date.vbsを追加しtimeshift_get.batを修正します。
date.vbs
' CScript date.vbs w
' CScript date.vbs /d:-6
Option Explicit
dim argDay
Dim aNamed
Set aNamed = WScript.Arguments.Named
argDay = WScript.Arguments. Named.Item("d")
Dim strFormattedDate
Dim argC
Dim i
Dim strCmd
Dim objFSO
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Dim aUnnamed
Set aUnnamed = WScript.Arguments.Unnamed
argC = ""
If aUnnamed.Count > 0 Then
For i = 0 To aUnnamed.Count - 1
Select Case i
Case 0
argC = aUnnamed.Item(i)
End Select
Next
End If
if not (argDay = "") Then
dim strNow
strNow = Now()
strFormattedDate = DateAdd("d",argDay,strNow)
strFormattedDate = Left(strFormattedDate, 10)
strFormattedDate = Replace(strFormattedDate, "/", "")
WScript.Echo strFormattedDate
End If
if (argC = "w") Then
WScript.Quit(WeekDay(Date))
End If
日付計算のためのスプリクトです。
timeshift_get.bat
D:
cd \RadikoRec
set F=./rec/
REM TBS,QRR,LFR,RN1,RN2,INT,FMT,FMJ,JORF,BAYFM78,NACK5,YFM,HOUSOU-DAIGAKU
goto DAY
:MON
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%175000 %D%180000 %F%%D%1750_週刊自動車批評
exit /b
:TUE
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%010000 %D%030000 %F%%D%0100_JUNK_伊集院光・深夜の馬鹿力
REM 終了時間が日付をまたぐので一日足す
set /a dayC=%dayC%+1
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D2=%%i
call :get_ts RN1 %D%233000 %D2%000000 %F%%D%2330_Anime_&_Seiyu_Music_Night
exit /b
:WED
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%010000 %D%030000 %F%%D%0100_JUNK_爆笑問題カーボーイ
call :get_ts RN2 %D%223000 %D%230000 %F%%D%2230_ライダーズ
exit /b
:THU
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%010000 %D%030000 %F%%D%0100_JUNK_山里亮太の不毛な議論
exit /b
:FRI
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%010000 %D%030000 %F%%D%0100_JUNK_おぎやはぎのメガネびいき
call :get_ts LFR %D%010000 %D%030000 %F%%D%0100_LFR_ナインティナイン_岡村のオールナイトニッポン
exit /b
:SAT
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%010000 %D%030000 %F%%D%0100_JUNK_バナナマンのバナナムーンGOLD
call :get_ts FMT %D%170000 %D%175000 %F%%D%1700_MITSUBISHI_MOTORS_ピートのふしぎなガレージ
call :get_ts TBS %D%130000 %D%145500 %F%%D%1300_久米宏_ラジオなんですけど
call :get_ts QRR %D%210000 %D%230000 %F%%D%2100_A&G_TRIBAL_RADIO_エジソン
REM 終了時間が日付をまたぐので一日足す
set /a dayC=%dayC%+1
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D2=%%i
call :get_ts QRR %D%230000 %D2%000000 %F%%D%2300_A&Gメディアステーション_こむちゃっとカウントダウン
exit /b
:SUN
for /f %%i in ('CScript date.vbs /d:%dayC%') do SET D=%%i
call :get_ts TBS %D%130000 %D%170000 %F%%D%1300_爆笑問題の日曜サンデー
exit /b
REM ここから処理部分
:DAY
cscript /b date.vbs w
if %errorlevel%==7 set WDAY=SAT
if %errorlevel%==6 set WDAY=FRI
if %errorlevel%==5 set WDAY=THU
if %errorlevel%==4 set WDAY=WED
if %errorlevel%==3 set WDAY=TUE
if %errorlevel%==2 set WDAY=MON
if %errorlevel%==1 set WDAY=SUN
if "%WDAY%" == "MON" (
set /a dayC=-6
call :TUE
set /a dayC=-5
call :WED
set /a dayC=-4
call :THU
set /a dayC=-3
call :FRI
set /a dayC=-2
call :SAT
set /a dayC=-1
call :SUN
set /a dayC=0
call :MON
exit
)
if "%WDAY%" == "TUE" (
set /a dayC=-6
call :WED
set /a dayC=-5
call :THU
set /a dayC=-4
call :FRI
set /a dayC=-3
call :SAT
set /a dayC=-2
call :SUN
set /a dayC=-1
call :MON
set /a dayC=0
call :TUE
exit
)
if "%WDAY%" == "WED" (
set /a dayC=-6
call :THU
set /a dayC=-5
call :FRI
set /a dayC=-4
call :SAT
set /a dayC=-3
call :SUN
set /a dayC=-2
call :MON
set /a dayC=-1
call :TUE
set /a dayC=0
call :WED
exit
)
if "%WDAY%" == "THU" (
set /a dayC=-6
call :FRI
set /a dayC=-5
call :SAT
set /a dayC=-4
call :SUN
set /a dayC=-3
call :MON
set /a dayC=-2
call :TUE
set /a dayC=-1
call :WED
set /a dayC=0
call :THU
exit
)
if "%WDAY%" == "FRI" (
set /a dayC=-6
call :SAT
set /a dayC=-5
call :SUN
set /a dayC=-4
call :MON
set /a dayC=-3
call :TUE
set /a dayC=-2
call :WED
set /a dayC=-1
call :THU
set /a dayC=0
call :FRI
exit
)
if "%WDAY%" == "SAT" (
set /a dayC=-6
call :SUN
set /a dayC=-5
call :MON
set /a dayC=-4
call :TUE
set /a dayC=-3
call :WED
set /a dayC=-2
call :THU
set /a dayC=-1
call :FRI
set /a dayC=0
call :SAT
exit
)
if "%WDAY%" == "SUN" (
set /a dayC=-6
call :MON
set /a dayC=-5
call :TUE
set /a dayC=-4
call :WED
set /a dayC=-3
call :THU
set /a dayC=-2
call :FRI
set /a dayC=-1
call :SAT
set /a dayC=0
call :SUN
exit
)
echo date.vbs処理エラー
pause
:get_ts
set ch=%1
set ft=%2
set to=%3
set AYTHKeyGet=AYTHKeyGet.vbs
del timeshift.m3u8
for /f %%i in ('CScript %AYTHKeyGet% %ch%') do SET AUTHTOKEN=%%i
wget -q --header="pragma: no-cache" --header="Content-Type: application/x-www-form-urlencoded" --header="X-Radiko-AuthToken: %AUTHTOKEN%" --header="Referer: http://radiko.jp/apps/js/flash/myplayer-release.swf" --post-data='flash=1' --no-check-certificate -O timeshift.m3u8 "https://radiko.jp/v2/api/ts/playlist.m3u8?l=15&station_id=%ch%&ft=%ft%&to=%to%"
for /f %%i in ('find "radiko" timeshift.m3u8') do SET PLAYLIST_URL=%%i
REM ffmpeg -headers "X-Radiko-AuthToken: %AUTHTOKEN%" -i %PLAYLIST_URL% "%4.m4a"
ffmpeg -headers "X-Radiko-AuthToken: %AUTHTOKEN%" -i %PLAYLIST_URL% "%4.ts"
exit /b
毎日いつ実行してもいい状況を想定して書いてあります。
F=./rec/は録音ファイルのフォルダー名です。
MON(月)TUE(火)WED(水)THU(木)FRI(金)SAT(土)SUN(日)
なと曜日でダウンロードしたい日に番組を指定していきます。
get_ts 局名 開始時間 終了時間 録音ファイル名 です
EXITでバッチが終了します。
タイムフリーは一週間分しかダウンロードできません。ラジコプレミアムに加入してればどの地域の人でもダウンロードできます。
http://hanpen.lsv.jp/blog.hanpen.net/radiko-jp%e3%81%ae%e3%83%a9%e3%82%b8%e3%82%b3%e3%83%97%e3%83%ac%e3%83%9f%e3%82%a2%e3%83%a0%e3%81%ab%e5%af%be%e5%bf%9c%e3%81%97%e3%81%9f/
こちらを参照してください。



