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