garret1317 / yt-dlp-rajiko

improved radiko.jp extractor for yt-dlp
https://427738.xyz/yt-dlp-rajiko/
Other
23 stars 1 forks source link

don't download from stations w/ no timefree (nhk) #15

Closed garret1317 closed 10 months ago

garret1317 commented 10 months ago

nhk doesn't have timefree, and it says as much on the programme pages (use nhk radiru instead)

download doesn't fail though, you just get a loop of elevator music and an apology that its not available (lasting the duration if the programme) would prefer not to have that, just wastes space and time

iirc theres timefree/areafree availability in the stations xml, grab and store that somehow, probably in the same place as station regions, then fail in the sameish way as for not aired/not finished

maybe suggest radiru? but wouldn't really work for not nhk lol though don't know if there are others with no timefree

garret1317 commented 10 months ago

hmm, doesnt appear to be in the stations list

<id>JOLK</id>
<name>NHKラジオ第1(福岡)</name>
<ascii_name>JOLK</ascii_name>
<ruby>えぬえいちけーらじおだいいちふくおか</ruby>
<areafree>0</areafree>
<timefree>1</timefree>

all nhk stations are areafree 0, timefree 1

maybe its in the programme json

garret1317 commented 10 months ago

ts_in_ng/ts_out_ng in the programme json, might be it

for timefree available (CCL):

ts_in_ng: 0
ts_out_ng: 0

for no timefree (JOBK):

ts_in_ng: 2
ts_out_ng: 2

but what do the numbers mean? why are there two? is it ever 1?

might need to read the site js

garret1317 commented 10 months ago
if (!data.isAreaFree) {
   data.nowPlayArea = '<p class="live-detail__plan invalid-station">この放送局の番組は、<br />放送エリア外からは聴取することができません。</p>';
   $btnList.remove();
}
else if (+data.isFuture === 0) {
   data.nowPlayArea = '<p class="live-detail__plan">この番組は' + data.progStartTime + '〜配信予定です</p>';
}
else if (!_.contains($.Radiko.user_station_list, _stationId) && +data.tsInNg !== 2 && +data.tsOutNg === 2) {
   data.nowPlayArea = '<p class="live-detail__plan">この番組は、放送エリア外からは聴取することができません。 </p>';
   $btnList.remove();
}
else if (!_.contains($.Radiko.user_station_list, _stationId) && +data.tsInNg === 2 && data.tsOutNg === 2) {
   data.nowPlayArea = '<p class="live-detail__plan">この番組は、タイムフリー聴取機能では聴取することができません。</p>';
   $btnList.remove();
}
else if (_.contains($.Radiko.user_station_list, _stationId) && +data.tsInNg === 2) {
   data.nowPlayArea = '<p class="live-detail__plan">この番組は、タイムフリー聴取機能では聴取することができません。</p>';
   $btnList.remove();
}

from tsDetail.js

maybe tsInNg = playable in the area tsOutNg = playable outside the area

outside station area + playable in area + not playable outside = not available in your area outside station area + not playable in area + not playable outside area = not available on timefree inside station area + not playable in area = not available on timefree

we'll always be in the station area, so i think we only have to check tsInNg