1 from .common
import InfoExtractor
2 from .youtube
import YoutubeIE
3 from ..utils
import traverse_obj
6 class HolodexIE(InfoExtractor
):
7 _VALID_URL
= r
'''(?x)https?://(?:www\.|staging\.)?holodex\.net/(?:
8 api/v2/playlist/(?P<playlist>\d+)|
9 watch/(?P<id>[\w-]{11})(?:\?(?:[^#]+&)?playlist=(?P<playlist2>\d+))?
12 'url': 'https://holodex.net/watch/9kQ2GtvDV3s',
13 'md5': 'be5ffce2f0feae8ba4c01553abc0f175',
17 'title': '【おちゃめ機能】ホロライブが吹っ切れた【24人で歌ってみた】',
18 'channel_id': 'UCJFZiqLMntJufDCHc6bQixg',
19 'playable_in_embed': True,
22 'live_status': 'not_live',
23 'description': 'md5:040e866c09dc4ab899b36479f4b7c7a2',
24 'channel_url': 'https://www.youtube.com/channel/UCJFZiqLMntJufDCHc6bQixg',
25 'upload_date': '20200406',
26 'uploader_url': 'http://www.youtube.com/channel/UCJFZiqLMntJufDCHc6bQixg',
28 'channel': 'hololive ホロライブ - VTuber Group',
29 'categories': ['Music'],
30 'uploader': 'hololive ホロライブ - VTuber Group',
31 'channel_follower_count': int,
32 'uploader_id': 'UCJFZiqLMntJufDCHc6bQixg',
33 'availability': 'public',
34 'thumbnail': 'https://i.ytimg.com/vi_webp/9kQ2GtvDV3s/maxresdefault.webp',
39 'url': 'https://holodex.net/api/v2/playlist/239',
42 'title': 'Songs/Videos that made fall into the rabbit hole (from my google activity history)',
46 'url': 'https://holodex.net/watch/_m2mQyaofjI?foo=bar&playlist=69',
49 'title': '拿著金斧頭的藍髮大姊姊',
53 'url': 'https://holodex.net/watch/_m2mQyaofjI?playlist=69',
57 'playable_in_embed': True,
59 'uploader': 'Ernst / エンスト',
61 'uploader_url': 'http://www.youtube.com/channel/UCqSX4PPZY0cyetqKVY_wRVA',
62 'categories': ['Entertainment'],
63 'title': '【星街すいせい】星街向你獻上晚安',
64 'upload_date': '20210705',
65 'description': 'md5:8b8ffb157bae77f2d109021a0b577d4a',
66 'channel': 'Ernst / エンスト',
67 'channel_id': 'UCqSX4PPZY0cyetqKVY_wRVA',
68 'channel_follower_count': int,
71 'live_status': 'not_live',
72 'channel_url': 'https://www.youtube.com/channel/UCqSX4PPZY0cyetqKVY_wRVA',
73 'availability': 'public',
74 'thumbnail': 'https://i.ytimg.com/vi_webp/_m2mQyaofjI/maxresdefault.webp',
76 'uploader_id': 'UCqSX4PPZY0cyetqKVY_wRVA',
79 'params': {'noplaylist': True},
81 'url': 'https://staging.holodex.net/api/v2/playlist/125',
82 'only_matching': True,
84 'url': 'https://staging.holodex.net/watch/rJJTJA_T_b0?playlist=25',
85 'only_matching': True,
87 'url': 'https://staging.holodex.net/watch/s1ifBeukThg',
88 'only_matching': True,
91 def _real_extract(self
, url
):
92 video_id
, playlist_id
, pl_id2
= self
._match
_valid
_url
(url
).group('id', 'playlist', 'playlist2')
93 playlist_id
= playlist_id
or pl_id2
95 if not self
._yes
_playlist
(playlist_id
, video_id
):
96 return self
.url_result(f
'https://www.youtube.com/watch?v={video_id}', YoutubeIE
)
98 data
= self
._download
_json
(f
'https://holodex.net/api/v2/playlist/{playlist_id}', playlist_id
)
99 return self
.playlist_from_matches(
100 traverse_obj(data
, ('videos', ..., 'id')), playlist_id
, data
.get('name'), ie
=YoutubeIE
)