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.

51 lines
2.0 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. thumbnail_url = self._search_regex(r'<meta property="og:image" content="(.+?)" />',
  28. webpage, u'thumbnail URL')
  29. uploader = self._search_regex(r'<meta name="uploader" content="(.+?)" />',
  30. webpage, u'uploader')
  31. title = self._search_regex(r'<meta property="og:title" content="(.+?)" />',
  32. webpage, u'Video title').replace(' | eHow', '')
  33. description = self._search_regex(r'<meta property="og:description" content="(.+?)" />',
  34. webpage, u'video description')
  35. ext = determine_ext(final_url)
  36. return {
  37. '_type': 'video',
  38. 'id': video_id,
  39. 'url': final_url,
  40. 'ext': ext,
  41. 'title': title,
  42. 'thumbnail': thumbnail_url,
  43. 'description': description,
  44. 'uploader': uploader,
  45. }