[ie/radiko] Extract unique id values (#10726)

Authored by: garret1317
This commit is contained in:
garret1317 2024-08-19 16:22:19 +01:00 committed by GitHub
parent a7d3235c84
commit c8d096c5ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@ from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
clean_html, clean_html,
join_nonempty,
time_seconds, time_seconds,
try_call, try_call,
unified_timestamp, unified_timestamp,
@ -167,7 +168,7 @@ class RadikoBaseIE(InfoExtractor):
class RadikoIE(RadikoBaseIE): class RadikoIE(RadikoBaseIE):
_VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<id>\d+)' _VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<timestring>\d+)'
_TESTS = [{ _TESTS = [{
# QRR (文化放送) station provides <desc> # QRR (文化放送) station provides <desc>
@ -183,8 +184,9 @@ class RadikoIE(RadikoBaseIE):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
station, video_id = self._match_valid_url(url).groups() station, timestring = self._match_valid_url(url).group('station', 'timestring')
vid_int = unified_timestamp(video_id, False) video_id = join_nonempty(station, timestring)
vid_int = unified_timestamp(timestring, False)
prog, station_program, ft, radio_begin, radio_end = self._find_program(video_id, station, vid_int) prog, station_program, ft, radio_begin, radio_end = self._find_program(video_id, station, vid_int)
auth_token, area_id = self._auth_client() auth_token, area_id = self._auth_client()
@ -207,7 +209,7 @@ class RadikoIE(RadikoBaseIE):
'ft': radio_begin, 'ft': radio_begin,
'end_at': radio_end, 'end_at': radio_end,
'to': radio_end, 'to': radio_end,
'seek': video_id, 'seek': timestring,
}, },
), ),
} }