puls4.py 2.2 KB

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