[cleanup] Fix infodict returned fields (#8906)
[yt-dlp3.git] / yt_dlp / extractor / miaopai.py
blob329ce365825ec01bf8fdef2d20cd60902dff3488
1 from .common import InfoExtractor
4 class MiaoPaiIE(InfoExtractor):
5 _VALID_URL = r'https?://(?:www\.)?miaopai\.com/show/(?P<id>[-A-Za-z0-9~_]+)'
6 _TEST = {
7 'url': 'http://www.miaopai.com/show/n~0hO7sfV1nBEw4Y29-Hqg__.htm',
8 'md5': '095ed3f1cd96b821add957bdc29f845b',
9 'info_dict': {
10 'id': 'n~0hO7sfV1nBEw4Y29-Hqg__',
11 'ext': 'mp4',
12 'title': '西游记音乐会的秒拍视频',
13 'thumbnail': 're:^https?://.*/n~0hO7sfV1nBEw4Y29-Hqg___m.jpg',
17 _USER_AGENT_IPAD = 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
19 def _real_extract(self, url):
20 video_id = self._match_id(url)
21 webpage = self._download_webpage(
22 url, video_id, headers={'User-Agent': self._USER_AGENT_IPAD})
24 title = self._html_extract_title(webpage)
25 thumbnail = self._html_search_regex(
26 r'<div[^>]+class=(?P<q1>[\'"]).*\bvideo_img\b.*(?P=q1)[^>]+data-url=(?P<q2>[\'"])(?P<url>[^\'"]+)(?P=q2)',
27 webpage, 'thumbnail', fatal=False, group='url')
28 videos = self._parse_html5_media_entries(url, webpage, video_id)
29 info = videos[0]
31 info.update({
32 'id': video_id,
33 'title': title,
34 'thumbnail': thumbnail,
36 return info