]> gitweb @ CieloNegro.org - youtube-dl.git/blob - youtube_dl/extractor/ebaumsworld.py
[toutv] really skip test
[youtube-dl.git] / youtube_dl / extractor / ebaumsworld.py
1 import re
2 import xml.etree.ElementTree
3
4 from .common import InfoExtractor
5 from ..utils import determine_ext
6
7
8 class EbaumsWorldIE(InfoExtractor):
9     _VALID_URL = r'https?://www\.ebaumsworld\.com/video/watch/(?P<id>\d+)'
10
11     _TEST = {
12         u'url': u'http://www.ebaumsworld.com/video/watch/83367677/',
13         u'file': u'83367677.mp4',
14         u'info_dict': {
15             u'title': u'A Giant Python Opens The Door',
16             u'description': u'This is how nightmares start...',
17             u'uploader': u'jihadpizza',
18         },
19     }
20
21     def _real_extract(self, url):
22         mobj = re.match(self._VALID_URL, url)
23         video_id = mobj.group('id')
24         config_xml = self._download_webpage(
25             'http://www.ebaumsworld.com/video/player/%s' % video_id, video_id)
26         config = xml.etree.ElementTree.fromstring(config_xml.encode('utf-8'))
27         video_url = config.find('file').text
28
29         return {
30             'id': video_id,
31             'title': config.find('title').text,
32             'url': video_url,
33             'ext': determine_ext(video_url),
34             'description': config.find('description').text,
35             'thumbnail': config.find('image').text,
36             'uploader': config.find('username').text,
37         }