]>
Commit | Line | Data |
---|---|---|
1 | from __future__ import unicode_literals | |
2 | ||
3 | import re | |
4 | ||
5 | from .common import InfoExtractor | |
6 | from .fivemin import FiveMinIE | |
7 | from ..utils import ( | |
8 | url_basename, | |
9 | ) | |
10 | ||
11 | ||
12 | class EngadgetIE(InfoExtractor): | |
13 | _VALID_URL = r'''(?x)https?://www.engadget.com/ | |
14 | (?:video/5min/(?P<id>\d+)| | |
15 | [\d/]+/.*?) | |
16 | ''' | |
17 | ||
18 | _TEST = { | |
19 | 'url': 'http://www.engadget.com/video/5min/518153925/', | |
20 | 'md5': 'c6820d4828a5064447a4d9fc73f312c9', | |
21 | 'info_dict': { | |
22 | 'id': '518153925', | |
23 | 'ext': 'mp4', | |
24 | 'title': 'Samsung Galaxy Tab Pro 8.4 Review', | |
25 | }, | |
26 | 'add_ie': ['FiveMin'], | |
27 | } | |
28 | ||
29 | def _real_extract(self, url): | |
30 | mobj = re.match(self._VALID_URL, url) | |
31 | video_id = mobj.group('id') | |
32 | ||
33 | if video_id is not None: | |
34 | return FiveMinIE._build_result(video_id) | |
35 | else: | |
36 | title = url_basename(url) | |
37 | webpage = self._download_webpage(url, title) | |
38 | ids = re.findall(r'<iframe[^>]+?playList=(\d+)', webpage) | |
39 | return { | |
40 | '_type': 'playlist', | |
41 | 'title': title, | |
42 | 'entries': [FiveMinIE._build_result(id) for id in ids] | |
43 | } |