improve user video list

This commit is contained in:
c-basalt 2024-08-11 03:38:25 -04:00
parent d92f6fbaea
commit d9fd3dbdfa

View File

@ -217,34 +217,36 @@ class RPlayUserIE(InfoExtractor):
'id': '667adc9e9aa7f739a2158ff3', 'id': '667adc9e9aa7f739a2158ff3',
'title': '杏都める', 'title': '杏都める',
}, },
'playlist_mincount': 34, 'playlist_mincount': 35,
}, { }, {
'url': 'https://rplay.live/c/furachi?page=contents', 'url': 'https://rplay.live/c/furachi?page=contents',
'info_dict': { 'info_dict': {
'id': '65e07e60850f4527aab74757', 'id': '65e07e60850f4527aab74757',
'title': '逢瀬ふらち OuseFurachi', 'title': '逢瀬ふらち OuseFurachi',
}, },
'playlist_mincount': 77, 'playlist_mincount': 94,
}] }]
def _real_extract(self, url): def _real_extract(self, url):
user_id, short = self._match_valid_url(url).group('id', 'short') user_id, short = self._match_valid_url(url).group('id', 'short')
key = 'customUrl' if short == 'c' else 'userOid' key = 'customUrl' if short == 'c' else 'userOid'
user_info = self._download_json( user_info = self._download_json('https://api.rplay.live/account/getuser', user_id, query={
f'https://api.rplay.live/account/getuser?{key}={user_id}&filter[]=nickname&filter[]=published', user_id) key: user_id, 'filter[]': ['nickname', 'published', 'publishedClips'],
'options': '{"includeContentMetadata":true}'})
replays = self._download_json( replays = self._download_json(
'https://api.rplay.live/live/replays?=667e4cd99aa7f739a2c91852', user_id, query={ 'https://api.rplay.live/live/replays', user_id, query={'creatorOid': user_info.get('_id')})
'creatorOid': user_info.get('_id')})
entries = traverse_obj(user_info, ('published', ..., { def _entries():
lambda x: self.url_result(f'https://rplay.live/play/{x}/', ie=RPlayVideoIE, video_id=x)})) def _entry_ids():
for entry_id in traverse_obj(replays, (..., '_id', {str})): for entry in traverse_obj(user_info, ('metadataSet', ..., lambda _, v: v['_id'])):
if entry_id in user_info.get('published', []): yield entry['_id'], entry.get('title')
continue for entry in traverse_obj(replays, lambda _, v: v['_id']):
entries.append(self.url_result(f'https://rplay.live/play/{entry_id}/', ie=RPlayVideoIE, video_id=entry_id)) yield entry['_id'], entry.get('title')
for vid, title in dict(_entry_ids()).items():
yield self.url_result(f'https://rplay.live/play/{vid}', ie=RPlayVideoIE, id=vid, title=title)
return self.playlist_result(entries, user_info.get('_id', user_id), user_info.get('nickname')) return self.playlist_result(_entries(), user_info.get('_id', user_id), user_info.get('nickname'))
class RPlayLiveIE(RPlayBaseIE): class RPlayLiveIE(RPlayBaseIE):