mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-14 16:38:29 +00:00
Add additional metadata and preferred language support for rplaylive (#4)
* Add support for translated language from api in rplaylive * Add additional video metadata in rplaylive extractor * Tests and suggested changes Signed-off-by: craterdanger <lancebailor38@gmail.com> * Update README.md --------- Signed-off-by: craterdanger <lancebailor38@gmail.com> Co-authored-by: c-basalt <117849907+c-basalt@users.noreply.github.com>
This commit is contained in:
parent
2cc0e3e1f5
commit
24b267ebdd
@ -1867,6 +1867,7 @@ #### digitalconcerthall
|
|||||||
#### rplaylive
|
#### rplaylive
|
||||||
|
|
||||||
* `jwt_token`: JWT token that can be found as value of `_AUTHORIZATION_` entry from the browser local storage. This can be used as an alternative login method.
|
* `jwt_token`: JWT token that can be found as value of `_AUTHORIZATION_` entry from the browser local storage. This can be used as an alternative login method.
|
||||||
|
* `lang`: Provide language code (`en`, `jp`, `ko`) to use translated metadata (`title`, `description`, and `uploader`) when possible
|
||||||
|
|
||||||
**Note**: These options may be changed/removed in the future without concern for backward compatibility
|
**Note**: These options may be changed/removed in the future without concern for backward compatibility
|
||||||
|
|
||||||
|
@ -133,6 +133,9 @@ class RPlayVideoIE(RPlayBaseIE):
|
|||||||
'uploader': '杏都める',
|
'uploader': '杏都める',
|
||||||
'uploader_id': '667adc9e9aa7f739a2158ff3',
|
'uploader_id': '667adc9e9aa7f739a2158ff3',
|
||||||
'tags': ['杏都める', 'めいどるーちぇ', '無料', '耳舐め', 'ASMR'],
|
'tags': ['杏都める', 'めいどるーちぇ', '無料', '耳舐め', 'ASMR'],
|
||||||
|
'like_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'location': 'JP',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://rplay.live/play/66783c65dcd1c768a8a69f24/',
|
'url': 'https://rplay.live/play/66783c65dcd1c768a8a69f24/',
|
||||||
@ -152,7 +155,31 @@ class RPlayVideoIE(RPlayBaseIE):
|
|||||||
'tags': 'count:4',
|
'tags': 'count:4',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
'live_status': 'was_live',
|
'live_status': 'was_live',
|
||||||
|
'like_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'location': 'JP',
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://rplay.live/play/682065da13ed2c564c77d8f7',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '682065da13ed2c564c77d8f7',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'md5:9551c4c0ffe610ef57a87fd1e8941073',
|
||||||
|
'description': 'md5:eb03a6c7200022d1554ba67feb6043e0',
|
||||||
|
'timestamp': 1746953690,
|
||||||
|
'upload_date': '20250511',
|
||||||
|
'release_timestamp': 1746953805,
|
||||||
|
'release_date': '20250511',
|
||||||
|
'duration': 11.483,
|
||||||
|
'thumbnail': 'https://pb.rplay.live/thumbnail/682065da13ed2c564c77d8f7',
|
||||||
|
'uploader': 'Seldea',
|
||||||
|
'uploader_id': '64d483add2c96306099ef734',
|
||||||
|
'tags': ['셀데아', '무료', 'Free', '無料'],
|
||||||
|
'like_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'location': 'KR',
|
||||||
|
},
|
||||||
|
'params': {'extractor_args': {'rplaylive': {'lang': ['en']}}},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://rplay.live/play/664f6dbe8ff72ac8bb0aecfc',
|
'url': 'https://rplay.live/play/664f6dbe8ff72ac8bb0aecfc',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -170,6 +197,9 @@ class RPlayVideoIE(RPlayBaseIE):
|
|||||||
'uploader_id': '6640ce9db293d7d82bf76cfd',
|
'uploader_id': '6640ce9db293d7d82bf76cfd',
|
||||||
'tags': 'count:3',
|
'tags': 'count:3',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'like_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'location': 'JP',
|
||||||
},
|
},
|
||||||
'skip': 'subscribe required',
|
'skip': 'subscribe required',
|
||||||
}]
|
}]
|
||||||
@ -210,8 +240,22 @@ def _real_extract(self, url):
|
|||||||
'uploader_id': ('creatorOid', {str}),
|
'uploader_id': ('creatorOid', {str}),
|
||||||
'tags': ('hashtags', lambda _, v: v[0] != '_'),
|
'tags': ('hashtags', lambda _, v: v[0] != '_'),
|
||||||
'age_limit': (('hideContent', 'isAdultContent'), {lambda x: 18 if x else None}, any),
|
'age_limit': (('hideContent', 'isAdultContent'), {lambda x: 18 if x else None}, any),
|
||||||
|
'location': ('location', {str}),
|
||||||
|
'view_count': ('views', {int}),
|
||||||
|
'like_count': ('likes', {int}),
|
||||||
'live_status': ('isReplayContent', {lambda x: 'was_live' if x else None}),
|
'live_status': ('isReplayContent', {lambda x: 'was_live' if x else None}),
|
||||||
})
|
})
|
||||||
|
if preferred_lang := self._configuration_arg('lang', ie_key='rplaylive', default=[None])[0]:
|
||||||
|
translated_metainfo = traverse_obj(video_info, {
|
||||||
|
'title': ('multiLangTitle', preferred_lang, {str}),
|
||||||
|
'description': ('multiLangIntroText', preferred_lang, {str}),
|
||||||
|
'uploader': ('creatorInfo', 'multiLangNick', preferred_lang, {str}),
|
||||||
|
})
|
||||||
|
if missing := [k for k in ['title', 'description', 'uploader'] if k not in translated_metainfo]:
|
||||||
|
self.report_warning(
|
||||||
|
f'Did not find translations for {preferred_lang} for fields: {", ".join(missing)}; '
|
||||||
|
'will use original language for these field(s)', video_id)
|
||||||
|
metainfo.update(translated_metainfo)
|
||||||
|
|
||||||
m3u8_url = traverse_obj(video_info, ('canView', 'url', {url_or_none}))
|
m3u8_url = traverse_obj(video_info, ('canView', 'url', {url_or_none}))
|
||||||
if not m3u8_url:
|
if not m3u8_url:
|
||||||
|
Loading…
Reference in New Issue
Block a user