logo

youtube-dl

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

ehow.py (1518B)


  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..compat import compat_urllib_parse_unquote
  4. class EHowIE(InfoExtractor):
  5. IE_NAME = 'eHow'
  6. _VALID_URL = r'https?://(?:www\.)?ehow\.com/[^/_?]*_(?P<id>[0-9]+)'
  7. _TEST = {
  8. 'url': 'http://www.ehow.com/video_12245069_hardwood-flooring-basics.html',
  9. 'md5': '9809b4e3f115ae2088440bcb4efbf371',
  10. 'info_dict': {
  11. 'id': '12245069',
  12. 'ext': 'flv',
  13. 'title': 'Hardwood Flooring Basics',
  14. 'description': 'Hardwood flooring may be time consuming, but its ultimately a pretty straightforward concept. Learn about hardwood flooring basics with help from a hardware flooring business owner in this free video...',
  15. 'uploader': 'Erick Nathan',
  16. }
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. video_url = self._search_regex(
  22. r'(?:file|source)=(http[^\'"&]*)', webpage, 'video URL')
  23. final_url = compat_urllib_parse_unquote(video_url)
  24. uploader = self._html_search_meta('uploader', webpage)
  25. title = self._og_search_title(webpage).replace(' | eHow', '')
  26. return {
  27. 'id': video_id,
  28. 'url': final_url,
  29. 'title': title,
  30. 'thumbnail': self._og_search_thumbnail(webpage),
  31. 'description': self._og_search_description(webpage),
  32. 'uploader': uploader,
  33. }