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.

44 lines
1.4 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class DFBIE(InfoExtractor):
  5. IE_NAME = 'tv.dfb.de'
  6. _VALID_URL = r'https?://tv\.dfb\.de/video/[^/]+/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://tv.dfb.de/video/highlights-des-empfangs-in-berlin/9070/',
  9. # The md5 is different each time
  10. 'info_dict': {
  11. 'id': '9070',
  12. 'ext': 'flv',
  13. 'title': 'Highlights des Empfangs in Berlin',
  14. 'upload_date': '20140716',
  15. },
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. webpage = self._download_webpage(url, video_id)
  21. player_info = self._download_xml(
  22. 'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
  23. video_id)
  24. video_info = player_info.find('video')
  25. f4m_info = self._download_xml(self._proto_relative_url(video_info.find('url').text.strip()), video_id)
  26. token_el = f4m_info.find('token')
  27. manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
  28. return {
  29. 'id': video_id,
  30. 'title': video_info.find('title').text,
  31. 'url': manifest_url,
  32. 'ext': 'flv',
  33. 'thumbnail': self._og_search_thumbnail(webpage),
  34. 'upload_date': ''.join(video_info.find('time_date').text.split('.')[::-1]),
  35. }