]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xbef.py
Prepare new release.
[youtubedl] / youtube_dl / extractor / xbef.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..compat import compat_urllib_parse_unquote
5
6
7 class XBefIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)'
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,
17 'thumbnail': r're:^http://.*\.jpg',
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage = self._download_webpage(url, video_id)
24
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')
31 config_url = compat_urllib_parse_unquote(config_url_enc)
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 }