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.

46 lines
1.7 KiB

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