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.

51 lines
1.9 KiB

  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from .prosiebensat1 import ProSiebenSat1BaseIE
  4. from ..utils import (
  5. unified_strdate,
  6. parse_duration,
  7. compat_str,
  8. )
  9. class Puls4IE(ProSiebenSat1BaseIE):
  10. _VALID_URL = r'https?://(?:www\.)?puls4\.com/(?P<id>(?:[^/]+/)*?videos/[^?#]+)'
  11. _TESTS = [{
  12. 'url': 'http://www.puls4.com/2-minuten-2-millionen/staffel-3/videos/2min2miotalk/Tobias-Homberger-von-myclubs-im-2min2miotalk-118118',
  13. 'md5': 'fd3c6b0903ac72c9d004f04bc6bb3e03',
  14. 'info_dict': {
  15. 'id': '118118',
  16. 'ext': 'flv',
  17. 'title': 'Tobias Homberger von myclubs im #2min2miotalk',
  18. 'description': 'md5:f9def7c5e8745d6026d8885487d91955',
  19. 'upload_date': '20160830',
  20. 'uploader': 'PULS_4',
  21. },
  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': compat_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