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.

41 lines
1.1 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. url_basename,
  6. )
  7. class EngadgetIE(InfoExtractor):
  8. _VALID_URL = r'''(?x)https?://www.engadget.com/
  9. (?:video(?:/5min)?/(?P<id>\d+)|
  10. [\d/]+/.*?)
  11. '''
  12. _TEST = {
  13. 'url': 'http://www.engadget.com/video/5min/518153925/',
  14. 'md5': 'c6820d4828a5064447a4d9fc73f312c9',
  15. 'info_dict': {
  16. 'id': '518153925',
  17. 'ext': 'mp4',
  18. 'title': 'Samsung Galaxy Tab Pro 8.4 Review',
  19. },
  20. 'add_ie': ['FiveMin'],
  21. }
  22. def _real_extract(self, url):
  23. video_id = self._match_id(url)
  24. if video_id is not None:
  25. return self.url_result('5min:%s' % video_id)
  26. else:
  27. title = url_basename(url)
  28. webpage = self._download_webpage(url, title)
  29. ids = re.findall(r'<iframe[^>]+?playList=(\d+)', webpage)
  30. return {
  31. '_type': 'playlist',
  32. 'title': title,
  33. 'entries': [self.url_result('5min:%s' % vid) for vid in ids]
  34. }