]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/engadget.py
debian/changelog: Annotate bugs to close.
[youtubedl] / youtube_dl / extractor / engadget.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import (
7 url_basename,
8 )
9
10
11 class EngadgetIE(InfoExtractor):
12 _VALID_URL = r'''(?x)https?://www.engadget.com/
13 (?:video/5min/(?P<id>\d+)|
14 [\d/]+/.*?)
15 '''
16
17 _TEST = {
18 'url': 'http://www.engadget.com/video/5min/518153925/',
19 'md5': 'c6820d4828a5064447a4d9fc73f312c9',
20 'info_dict': {
21 'id': '518153925',
22 'ext': 'mp4',
23 'title': 'Samsung Galaxy Tab Pro 8.4 Review',
24 },
25 'add_ie': ['FiveMin'],
26 }
27
28 def _real_extract(self, url):
29 video_id = self._match_id(url)
30
31 if video_id is not None:
32 return self.url_result('5min:%s' % video_id)
33 else:
34 title = url_basename(url)
35 webpage = self._download_webpage(url, title)
36 ids = re.findall(r'<iframe[^>]+?playList=(\d+)', webpage)
37 return {
38 '_type': 'playlist',
39 'title': title,
40 'entries': [self.url_result('5min:%s' % vid) for vid in ids]
41 }