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.

37 lines
1.2 KiB

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