[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / ebaumsworld.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class EbaumsWorldIE(InfoExtractor):
7     _VALID_URL = r'https?://(?:www\.)?ebaumsworld\.com/videos/[^/]+/(?P<id>\d+)'
8
9     _TEST = {
10         'url': 'http://www.ebaumsworld.com/videos/a-giant-python-opens-the-door/83367677/',
11         'info_dict': {
12             'id': '83367677',
13             'ext': 'mp4',
14             'title': 'A Giant Python Opens The Door',
15             'description': 'This is how nightmares start...',
16             'uploader': 'jihadpizza',
17         },
18     }
19
20     def _real_extract(self, url):
21         video_id = self._match_id(url)
22         config = self._download_xml(
23             'http://www.ebaumsworld.com/video/player/%s' % video_id, video_id)
24         video_url = config.find('file').text
25
26         return {
27             'id': video_id,
28             'title': config.find('title').text,
29             'url': video_url,
30             'description': config.find('description').text,
31             'thumbnail': config.find('image').text,
32             'uploader': config.find('username').text,
33         }