2014-02-10 13:45:17 -06:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2013-06-23 15:30:16 -05:00
|
|
|
from .common import InfoExtractor
|
2015-07-03 11:32:56 -05:00
|
|
|
from ..utils import parse_iso8601
|
2013-06-23 15:30:16 -05:00
|
|
|
|
|
|
|
|
|
|
|
class HowcastIE(InfoExtractor):
|
2014-02-10 13:45:17 -06:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?howcast\.com/videos/(?P<id>\d+)'
|
2013-06-27 13:46:46 -05:00
|
|
|
_TEST = {
|
2014-02-10 13:45:17 -06:00
|
|
|
'url': 'http://www.howcast.com/videos/390161-How-to-Tie-a-Square-Knot-Properly',
|
2016-05-24 05:24:29 -05:00
|
|
|
'md5': '7d45932269a288149483144f01b99789',
|
2014-02-10 13:45:17 -06:00
|
|
|
'info_dict': {
|
|
|
|
'id': '390161',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'How to Tie a Square Knot Properly',
|
2015-07-03 11:32:56 -05:00
|
|
|
'description': 'md5:dbe792e5f6f1489027027bf2eba188a3',
|
|
|
|
'timestamp': 1276081287,
|
|
|
|
'upload_date': '20100609',
|
2015-12-04 09:18:02 -06:00
|
|
|
'duration': 56.823,
|
2015-07-03 11:32:56 -05:00
|
|
|
},
|
2016-05-24 10:42:22 -05:00
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
2016-05-24 05:24:29 -05:00
|
|
|
'add_ie': ['Ooyala'],
|
2013-06-27 13:46:46 -05:00
|
|
|
}
|
2013-06-23 15:30:16 -05:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2015-07-03 11:32:56 -05:00
|
|
|
video_id = self._match_id(url)
|
2013-06-23 15:30:16 -05:00
|
|
|
|
2013-09-11 10:36:23 -05:00
|
|
|
webpage = self._download_webpage(url, video_id)
|
2013-06-23 15:30:16 -05:00
|
|
|
|
2015-07-03 11:32:56 -05:00
|
|
|
embed_code = self._search_regex(
|
|
|
|
r'<iframe[^>]+src="[^"]+\bembed_code=([^\b]+)\b',
|
|
|
|
webpage, 'ooyala embed code')
|
2013-06-23 15:30:16 -05:00
|
|
|
|
2014-02-10 13:45:17 -06:00
|
|
|
return {
|
2015-07-03 11:32:56 -05:00
|
|
|
'_type': 'url_transparent',
|
|
|
|
'ie_key': 'Ooyala',
|
|
|
|
'url': 'ooyala:%s' % embed_code,
|
2014-02-10 13:45:17 -06:00
|
|
|
'id': video_id,
|
2015-07-03 11:32:56 -05:00
|
|
|
'timestamp': parse_iso8601(self._html_search_meta(
|
|
|
|
'article:published_time', webpage, 'timestamp')),
|
2014-02-10 13:45:17 -06:00
|
|
|
}
|