]>
Commit | Line | Data |
---|---|---|
3ca3f77f U |
1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
4 | from ..utils import parse_iso8601 | |
5 | ||
6 | ||
7 | class HowcastIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://(?:www\.)?howcast\.com/videos/(?P<id>\d+)' | |
9 | _TEST = { | |
10 | 'url': 'http://www.howcast.com/videos/390161-How-to-Tie-a-Square-Knot-Properly', | |
11 | 'md5': '7d45932269a288149483144f01b99789', | |
12 | 'info_dict': { | |
13 | 'id': '390161', | |
14 | 'ext': 'mp4', | |
15 | 'title': 'How to Tie a Square Knot Properly', | |
16 | 'description': 'md5:dbe792e5f6f1489027027bf2eba188a3', | |
17 | 'timestamp': 1276081287, | |
18 | 'upload_date': '20100609', | |
19 | 'duration': 56.823, | |
20 | }, | |
21 | 'params': { | |
22 | 'skip_download': True, | |
23 | }, | |
24 | 'add_ie': ['Ooyala'], | |
25 | } | |
26 | ||
27 | def _real_extract(self, url): | |
28 | video_id = self._match_id(url) | |
29 | ||
30 | webpage = self._download_webpage(url, video_id) | |
31 | ||
32 | embed_code = self._search_regex( | |
33 | r'<iframe[^>]+src="[^"]+\bembed_code=([^\b]+)\b', | |
34 | webpage, 'ooyala embed code') | |
35 | ||
36 | return { | |
37 | '_type': 'url_transparent', | |
38 | 'ie_key': 'Ooyala', | |
39 | 'url': 'ooyala:%s' % embed_code, | |
40 | 'id': video_id, | |
41 | 'timestamp': parse_iso8601(self._html_search_meta( | |
42 | 'article:published_time', webpage, 'timestamp')), | |
43 | } |