Merge remote-tracking branch 'h-collector/master'
[youtube-dl] / youtube_dl / extractor / eroprofile.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class EroProfileIE(InfoExtractor):
7     _VALID_URL = r'https?://(?:www\.)?eroprofile\.com/m/videos/view/(?P<id>[^/]+)'
8     _TEST = {
9         'url': 'http://www.eroprofile.com/m/videos/view/sexy-babe-softcore',
10         'md5': 'c26f351332edf23e1ea28ce9ec9de32f',
11         'info_dict': {
12             'id': '3733775',
13             'display_id': 'sexy-babe-softcore',
14             'ext': 'm4v',
15             'title': 'sexy babe softcore',
16             'thumbnail': 're:https?://.*\.jpg',
17             'age_limit': 18,
18         }
19     }
20
21     def _real_extract(self, url):
22         display_id = self._match_id(url)
23
24         webpage = self._download_webpage(url, display_id)
25
26         video_id = self._search_regex(
27             [r"glbUpdViews\s*\('\d*','(\d+)'", r'p/report/video/(\d+)'],
28             webpage, 'video id', default=None)
29
30         video_url = self._search_regex(
31             r'<source src="([^"]+)', webpage, 'video url')
32         title = self._html_search_regex(
33             r'Title:</th><td>([^<]+)</td>', webpage, 'title')
34         thumbnail = self._search_regex(
35             r'onclick="showVideoPlayer\(\)"><img src="([^"]+)',
36             webpage, 'thumbnail', fatal=False)
37
38         return {
39             'id': video_id,
40             'display_id': display_id,
41             'url': video_url,
42             'title': title,
43             'thumbnail': thumbnail,
44             'age_limit': 18,
45         }