]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/ebaumsworld.py
[ebaumsworld] Modernize
[yt-dlp.git] / youtube_dl / extractor / ebaumsworld.py
CommitLineData
cf0c5fa3
PH
1from __future__ import unicode_literals
2
3d60bb96 3import re
3d60bb96
JMF
4
5from .common import InfoExtractor
6from ..utils import determine_ext
7
8
9class EbaumsWorldIE(InfoExtractor):
10 _VALID_URL = r'https?://www\.ebaumsworld\.com/video/watch/(?P<id>\d+)'
11
12 _TEST = {
cf0c5fa3
PH
13 'url': 'http://www.ebaumsworld.com/video/watch/83367677/',
14 'info_dict': {
15 'id': '83367677',
16 'ext': 'mp4',
17 'title': 'A Giant Python Opens The Door',
18 'description': 'This is how nightmares start...',
19 'uploader': 'jihadpizza',
3d60bb96
JMF
20 },
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
e26f8712 26 config = self._download_xml(
3d60bb96 27 'http://www.ebaumsworld.com/video/player/%s' % video_id, video_id)
3d60bb96
JMF
28 video_url = config.find('file').text
29
30 return {
31 'id': video_id,
32 'title': config.find('title').text,
33 'url': video_url,
34 'ext': determine_ext(video_url),
35 'description': config.find('description').text,
36 'thumbnail': config.find('image').text,
37 'uploader': config.find('username').text,
38 }