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.

35 lines
1.1 KiB

  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import determine_ext
  4. class EbaumsWorldIE(InfoExtractor):
  5. _VALID_URL = r'https?://www\.ebaumsworld\.com/video/watch/(?P<id>\d+)'
  6. _TEST = {
  7. u'url': u'http://www.ebaumsworld.com/video/watch/83367677/',
  8. u'file': u'83367677.mp4',
  9. u'info_dict': {
  10. u'title': u'A Giant Python Opens The Door',
  11. u'description': u'This is how nightmares start...',
  12. u'uploader': u'jihadpizza',
  13. },
  14. }
  15. def _real_extract(self, url):
  16. mobj = re.match(self._VALID_URL, url)
  17. video_id = mobj.group('id')
  18. config = self._download_xml(
  19. 'http://www.ebaumsworld.com/video/player/%s' % video_id, video_id)
  20. video_url = config.find('file').text
  21. return {
  22. 'id': video_id,
  23. 'title': config.find('title').text,
  24. 'url': video_url,
  25. 'ext': determine_ext(video_url),
  26. 'description': config.find('description').text,
  27. 'thumbnail': config.find('image').text,
  28. 'uploader': config.find('username').text,
  29. }