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.

49 lines
1.7 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import unified_strdate
  5. class DFBIE(InfoExtractor):
  6. IE_NAME = 'tv.dfb.de'
  7. _VALID_URL = r'https?://tv\.dfb\.de/video/(?P<display_id>[^/]+)/(?P<id>\d+)'
  8. _TEST = {
  9. 'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/',
  10. # The md5 is different each time
  11. 'info_dict': {
  12. 'id': '11633',
  13. 'display_id': 'u-19-em-stimmen-zum-spiel-gegen-russland',
  14. 'ext': 'flv',
  15. 'title': 'U 19-EM: Stimmen zum Spiel gegen Russland',
  16. 'upload_date': '20150714',
  17. },
  18. }
  19. def _real_extract(self, url):
  20. mobj = re.match(self._VALID_URL, url)
  21. video_id = mobj.group('id')
  22. display_id = mobj.group('display_id')
  23. webpage = self._download_webpage(url, display_id)
  24. player_info = self._download_xml(
  25. 'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
  26. display_id)
  27. video_info = player_info.find('video')
  28. f4m_info = self._download_xml(
  29. self._proto_relative_url(video_info.find('url').text.strip()), display_id)
  30. token_el = f4m_info.find('token')
  31. manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
  32. formats = self._extract_f4m_formats(manifest_url, display_id)
  33. return {
  34. 'id': video_id,
  35. 'display_id': display_id,
  36. 'title': video_info.find('title').text,
  37. 'thumbnail': self._og_search_thumbnail(webpage),
  38. 'upload_date': unified_strdate(video_info.find('time_date').text),
  39. 'formats': formats,
  40. }