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.6 KiB

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