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