You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

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