[ie/dplay] Fix extractors (#10471)
[yt-dlp3.git] / yt_dlp / extractor / fuyintv.py
blobf46839bba6f5a38c57b9de9cf849687318a55fdb
1 from .common import InfoExtractor
2 from ..utils import traverse_obj
5 class FuyinTVIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?fuyin\.tv/html/(?:\d+)/(?P<id>\d+)\.html'
7 _TESTS = [{
8 'url': 'https://www.fuyin.tv/html/2733/44129.html',
9 'info_dict': {
10 'id': '44129',
11 'ext': 'mp4',
12 'title': '第1集',
13 'description': 'md5:21a3d238dc8d49608e1308e85044b9c3',
17 def _real_extract(self, url):
18 video_id = self._match_id(url)
19 json_data = self._download_json(
20 'https://www.fuyin.tv/api/api/tv.movie/url',
21 video_id, query={'urlid': f'{video_id}'})
22 webpage = self._download_webpage(url, video_id, fatal=False)
24 return {
25 'id': video_id,
26 'title': traverse_obj(json_data, ('data', 'title')),
27 'url': json_data['data']['url'],
28 'ext': 'mp4',
29 'description': self._html_search_meta('description', webpage),