mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-27 17:08:32 +00:00
check station broadcast area + areafree status when getting formats
This commit is contained in:
parent
44fb821cc4
commit
ea26e74296
@ -184,10 +184,19 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
|
||||
f'https://radiko.jp/v3/station/stream/pc_html5/{station}.xml', video_id,
|
||||
note='Downloading stream information')
|
||||
|
||||
station_info = self._download_json(
|
||||
f'https://radiko.jp/api/stations/batchGetStations?stationId={station}', video_id,
|
||||
note='Checking station broadcast areas')
|
||||
station_areas = traverse_obj(station_info, ('stationList', ..., 'prefecturesList'), get_all=False)
|
||||
|
||||
formats = []
|
||||
found = set()
|
||||
|
||||
timefree_int = 0 if is_onair else 1
|
||||
stream_type = 'b' if area_id in station_areas else 'c'
|
||||
|
||||
if stream_type == 'c' and not self._check_privileges()['areafree']:
|
||||
self.raise_login_required('Programme is only available with an Areafree subscription')
|
||||
|
||||
for element in m3u8_playlist_data.findall(f'.//url[@timefree="{timefree_int}"]/playlist_create_url'):
|
||||
pcu = element.text
|
||||
@ -199,7 +208,7 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
|
||||
**query,
|
||||
'l': '15',
|
||||
'lsid': ''.join(random.choices('0123456789abcdef', k=32)),
|
||||
'type': 'b',
|
||||
'type': stream_type,
|
||||
})
|
||||
|
||||
time_to_skip = None if is_onair else cursor - ft
|
||||
|
Loading…
Reference in New Issue
Block a user