]> jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/empflix.py
[gameone] Fix indentation and removed unused constants
[yt-dlp.git] / youtube_dl / extractor / empflix.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import (
7 ExtractorError,
8 )
9
10
11 class EmpflixIE(InfoExtractor):
12 _VALID_URL = r'^https?://www\.empflix\.com/videos/.*?-(?P<id>[0-9]+)\.html'
13 _TEST = {
14 'url': 'http://www.empflix.com/videos/Amateur-Finger-Fuck-33051.html',
15 'md5': '5e5cc160f38ca9857f318eb97146e13e',
16 'info_dict': {
17 'id': '33051',
18 'ext': 'flv',
19 'title': 'Amateur Finger Fuck',
20 'age_limit': 18,
21 }
22 }
23
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
27
28 webpage = self._download_webpage(url, video_id)
29 age_limit = self._rta_search(webpage)
30
31 video_title = self._html_search_regex(
32 r'name="title" value="(?P<title>[^"]*)"', webpage, 'title')
33
34 cfg_url = self._html_search_regex(
35 r'flashvars\.config = escape\("([^"]+)"',
36 webpage, 'flashvars.config')
37
38 cfg_xml = self._download_xml(
39 cfg_url, video_id, note='Downloading metadata')
40 video_url = cfg_xml.find('videoLink').text
41
42 return {
43 'id': video_id,
44 'url': video_url,
45 'ext': 'flv',
46 'title': video_title,
47 'age_limit': age_limit,
48 }