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