]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xbef.py
Annotate changelog bug being closed.
[youtubedl] / youtube_dl / extractor / xbef.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..compat import (
5 compat_urllib_parse,
6 )
7
8
9 class XBefIE(InfoExtractor):
10 _VALID_URL = r'http://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)'
11 _TEST = {
12 'url': 'http://xbef.com/video/5119-glamourous-lesbians-smoking-drinking-and-fucking',
13 'md5': 'a478b565baff61634a98f5e5338be995',
14 'info_dict': {
15 'id': '5119',
16 'ext': 'mp4',
17 'title': 'md5:7358a9faef8b7b57acda7c04816f170e',
18 'age_limit': 18,
19 'thumbnail': 're:^http://.*\.jpg',
20 }
21 }
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25 webpage = self._download_webpage(url, video_id)
26
27 title = self._html_search_regex(
28 r'<h1[^>]*>(.*?)</h1>', webpage, 'title')
29
30 config_url_enc = self._download_webpage(
31 'http://xbef.com/Main/GetVideoURLEncoded/%s' % video_id, video_id,
32 note='Retrieving config URL')
33 config_url = compat_urllib_parse.unquote(config_url_enc)
34 config = self._download_xml(
35 config_url, video_id, note='Retrieving config')
36
37 video_url = config.find('./file').text
38 thumbnail = config.find('./image').text
39
40 return {
41 'id': video_id,
42 'url': video_url,
43 'title': title,
44 'thumbnail': thumbnail,
45 'age_limit': 18,
46 }