]>
Commit | Line | Data |
---|---|---|
95be19d4 XY |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
95be19d4 XY |
5 | |
6 | ||
7 | class MiaoPaiIE(InfoExtractor): | |
f87feb4b | 8 | _VALID_URL = r'https?://(?:www\.)?miaopai\.com/show/(?P<id>[-A-Za-z0-9~_]+)' |
95be19d4 XY |
9 | _TEST = { |
10 | 'url': 'http://www.miaopai.com/show/n~0hO7sfV1nBEw4Y29-Hqg__.htm', | |
11 | 'md5': '095ed3f1cd96b821add957bdc29f845b', | |
12 | 'info_dict': { | |
13 | 'id': 'n~0hO7sfV1nBEw4Y29-Hqg__', | |
14 | 'ext': 'mp4', | |
15 | 'title': '西游记音乐会的秒拍视频', | |
16 | 'thumbnail': 're:^https?://.*/n~0hO7sfV1nBEw4Y29-Hqg___m.jpg', | |
17 | } | |
18 | } | |
19 | ||
f87feb4b | 20 | _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' |
95be19d4 XY |
21 | |
22 | def _real_extract(self, url): | |
23 | video_id = self._match_id(url) | |
f87feb4b YCH |
24 | webpage = self._download_webpage( |
25 | url, video_id, headers={'User-Agent': self._USER_AGENT_IPAD}) | |
95be19d4 | 26 | |
f87feb4b YCH |
27 | title = self._html_search_regex( |
28 | r'<title>([^<]+)</title>', webpage, 'title') | |
29 | thumbnail = self._html_search_regex( | |
30 | r'<div[^>]+class=(?P<q1>[\'"]).*\bvideo_img\b.*(?P=q1)[^>]+data-url=(?P<q2>[\'"])(?P<url>[^\'"]+)(?P=q2)', | |
31 | webpage, 'thumbnail', fatal=False, group='url') | |
a493f102 XY |
32 | videos = self._parse_html5_media_entries(url, webpage, video_id) |
33 | info = videos[0] | |
95be19d4 | 34 | |
f87feb4b YCH |
35 | info.update({ |
36 | 'id': video_id, | |
37 | 'title': title, | |
38 | 'thumbnail': thumbnail, | |
39 | }) | |
a493f102 | 40 | return info |