ehow.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from __future__ import unicode_literals
  2. from ..compat import (
  3. compat_urllib_parse,
  4. )
  5. from .common import InfoExtractor
  6. class EHowIE(InfoExtractor):
  7. IE_NAME = 'eHow'
  8. _VALID_URL = r'https?://(?:www\.)?ehow\.com/[^/_?]*_(?P<id>[0-9]+)'
  9. _TEST = {
  10. 'url': 'http://www.ehow.com/video_12245069_hardwood-flooring-basics.html',
  11. 'md5': '9809b4e3f115ae2088440bcb4efbf371',
  12. 'info_dict': {
  13. 'id': '12245069',
  14. 'ext': 'flv',
  15. 'title': 'Hardwood Flooring Basics',
  16. '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...',
  17. 'uploader': 'Erick Nathan',
  18. }
  19. }
  20. def _real_extract(self, url):
  21. video_id = self._match_id(url)
  22. webpage = self._download_webpage(url, video_id)
  23. video_url = self._search_regex(
  24. r'(?:file|source)=(http[^\'"&]*)', webpage, 'video URL')
  25. final_url = compat_urllib_parse.unquote(video_url)
  26. uploader = self._html_search_meta('uploader', webpage)
  27. title = self._og_search_title(webpage).replace(' | eHow', '')
  28. return {
  29. 'id': video_id,
  30. 'url': final_url,
  31. 'title': title,
  32. 'thumbnail': self._og_search_thumbnail(webpage),
  33. 'description': self._og_search_description(webpage),
  34. 'uploader': uploader,
  35. }