]>
Commit | Line | Data |
---|---|---|
933a5b37 JMF |
1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
4 | ||
5 | from .common import InfoExtractor | |
933a5b37 JMF |
6 | from ..utils import ( |
7 | url_basename, | |
8 | ) | |
9 | ||
10 | ||
11 | class EngadgetIE(InfoExtractor): | |
12 | _VALID_URL = r'''(?x)https?://www.engadget.com/ | |
97d5bfcb | 13 | (?:video(?:/5min)?/(?P<id>\d+)| |
933a5b37 JMF |
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): | |
5e1912cf | 29 | video_id = self._match_id(url) |
933a5b37 JMF |
30 | |
31 | if video_id is not None: | |
5e1912cf | 32 | return self.url_result('5min:%s' % video_id) |
933a5b37 JMF |
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, | |
5e1912cf | 40 | 'entries': [self.url_result('5min:%s' % vid) for vid in ids] |
933a5b37 | 41 | } |