]> jfr.im git - yt-dlp.git/blame - youtube_dlc/extractor/xbef.py
[skip travis] renaming
[yt-dlp.git] / youtube_dlc / extractor / xbef.py
CommitLineData
1986025d
PH
1from __future__ import unicode_literals
2
1986025d 3from .common import InfoExtractor
736f003f 4from ..compat import compat_urllib_parse_unquote
1986025d
PH
5
6
7class XBefIE(InfoExtractor):
5886b38d 8 _VALID_URL = r'https?://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)'
1986025d
PH
9 _TEST = {
10 'url': 'http://xbef.com/video/5119-glamourous-lesbians-smoking-drinking-and-fucking',
11 'md5': 'a478b565baff61634a98f5e5338be995',
12 'info_dict': {
13 'id': '5119',
14 'ext': 'mp4',
15 'title': 'md5:7358a9faef8b7b57acda7c04816f170e',
16 'age_limit': 18,
ec85ded8 17 'thumbnail': r're:^http://.*\.jpg',
1986025d
PH
18 }
19 }
20
21 def _real_extract(self, url):
1cc79574 22 video_id = self._match_id(url)
1986025d 23 webpage = self._download_webpage(url, video_id)
1cc79574 24
1986025d
PH
25 title = self._html_search_regex(
26 r'<h1[^>]*>(.*?)</h1>', webpage, 'title')
27
28 config_url_enc = self._download_webpage(
29 'http://xbef.com/Main/GetVideoURLEncoded/%s' % video_id, video_id,
30 note='Retrieving config URL')
736f003f 31 config_url = compat_urllib_parse_unquote(config_url_enc)
1986025d
PH
32 config = self._download_xml(
33 config_url, video_id, note='Retrieving config')
34
35 video_url = config.find('./file').text
36 thumbnail = config.find('./image').text
37
38 return {
39 'id': video_id,
40 'url': video_url,
41 'title': title,
42 'thumbnail': thumbnail,
43 'age_limit': 18,
44 }