logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

howcast.py (1370B)


  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': '7d45932269a288149483144f01b99789',
  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. 'skip_download': True,
  20. },
  21. 'add_ie': ['Ooyala'],
  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. }