]>
Commit | Line | Data |
---|---|---|
95be19d4 XY |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | from ..utils import sanitized_Request | |
6 | ||
7 | ||
8 | class MiaoPaiIE(InfoExtractor): | |
9 | _VALID_URL = r'https?://(?:www\.)?miaopai\.com/show/(?P<id>[-A-Za-z0-9~_]+).htm' | |
10 | _TEST = { | |
11 | 'url': 'http://www.miaopai.com/show/n~0hO7sfV1nBEw4Y29-Hqg__.htm', | |
12 | 'md5': '095ed3f1cd96b821add957bdc29f845b', | |
13 | 'info_dict': { | |
14 | 'id': 'n~0hO7sfV1nBEw4Y29-Hqg__', | |
15 | 'ext': 'mp4', | |
16 | 'title': '西游记音乐会的秒拍视频', | |
17 | 'thumbnail': 're:^https?://.*/n~0hO7sfV1nBEw4Y29-Hqg___m.jpg', | |
18 | } | |
19 | } | |
20 | ||
21 | _USER_AGENT_IPAD = 'User-Agent:Mozilla/5.0 ' \ | |
22 | '(iPad; CPU OS 9_1 like Mac OS X) ' \ | |
23 | 'AppleWebKit/601.1.46 (KHTML, like Gecko) ' \ | |
24 | 'Version/9.0 Mobile/13B143 Safari/601.1' | |
25 | ||
26 | def _real_extract(self, url): | |
27 | video_id = self._match_id(url) | |
28 | request = sanitized_Request(url) | |
29 | request.add_header('User-Agent', self._USER_AGENT_IPAD) | |
30 | webpage = self._download_webpage(request, video_id) | |
31 | ||
32 | title = self._html_search_regex(r'<title>([^<]*)</title>', | |
33 | webpage, | |
34 | 'title') | |
35 | regex = r"""<div *class=['"]video_img[^>]*data-url=['"]([^'"]*\.jpg)['"]""" | |
36 | thumbnail = self._html_search_regex(regex, webpage, '') | |
a493f102 XY |
37 | videos = self._parse_html5_media_entries(url, webpage, video_id) |
38 | info = videos[0] | |
95be19d4 | 39 | |
a493f102 XY |
40 | info.update({'id': video_id, |
41 | 'title': title, | |
42 | 'thumbnail': thumbnail, | |
43 | }) | |
44 | return info |