puls4.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from .prosiebensat1 import ProSiebenSat1BaseIE
  2. from ..utils import parse_duration, unified_strdate
  3. class Puls4IE(ProSiebenSat1BaseIE):
  4. _VALID_URL = r'https?://(?:www\.)?puls4\.com/(?P<id>[^?#&]+)'
  5. _TESTS = [{
  6. 'url': 'http://www.puls4.com/2-minuten-2-millionen/staffel-3/videos/2min2miotalk/Tobias-Homberger-von-myclubs-im-2min2miotalk-118118',
  7. 'md5': 'fd3c6b0903ac72c9d004f04bc6bb3e03',
  8. 'info_dict': {
  9. 'id': '118118',
  10. 'ext': 'flv',
  11. 'title': 'Tobias Homberger von myclubs im #2min2miotalk',
  12. 'description': 'md5:f9def7c5e8745d6026d8885487d91955',
  13. 'upload_date': '20160830',
  14. 'uploader': 'PULS_4',
  15. },
  16. }, {
  17. 'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident.-Norbert-Hofer',
  18. 'only_matching': True,
  19. }, {
  20. 'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident-Analyse-des-Interviews-mit-Norbert-Hofer-416598',
  21. 'only_matching': True,
  22. }]
  23. _TOKEN = 'puls4'
  24. _SALT = '01!kaNgaiNgah1Ie4AeSha'
  25. _CLIENT_NAME = ''
  26. def _real_extract(self, url):
  27. path = self._match_id(url)
  28. content_path = self._download_json(
  29. 'http://www.puls4.com/api/json-fe/page/' + path, path)['content'][0]['url']
  30. media = self._download_json(
  31. 'http://www.puls4.com' + content_path,
  32. content_path)['mediaCurrent']
  33. player_content = media['playerContent']
  34. info = self._extract_video_info(url, player_content['id'])
  35. info.update({
  36. 'id': str(media['objectId']),
  37. 'title': player_content['title'],
  38. 'description': media.get('description'),
  39. 'thumbnail': media.get('previewLink'),
  40. 'upload_date': unified_strdate(media.get('date')),
  41. 'duration': parse_duration(player_content.get('duration')),
  42. 'episode': player_content.get('episodePartName'),
  43. 'show': media.get('channel'),
  44. 'season_id': player_content.get('seasonId'),
  45. 'uploader': player_content.get('sourceCompany'),
  46. })
  47. return info