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