logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

puls4.py (2295B)


  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>[^?#&]+)'
  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. 'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident.-Norbert-Hofer',
  24. 'only_matching': True,
  25. }, {
  26. 'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident-Analyse-des-Interviews-mit-Norbert-Hofer-416598',
  27. 'only_matching': True,
  28. }]
  29. _TOKEN = 'puls4'
  30. _SALT = '01!kaNgaiNgah1Ie4AeSha'
  31. _CLIENT_NAME = ''
  32. def _real_extract(self, url):
  33. path = self._match_id(url)
  34. content_path = self._download_json(
  35. 'http://www.puls4.com/api/json-fe/page/' + path, path)['content'][0]['url']
  36. media = self._download_json(
  37. 'http://www.puls4.com' + content_path,
  38. content_path)['mediaCurrent']
  39. player_content = media['playerContent']
  40. info = self._extract_video_info(url, player_content['id'])
  41. info.update({
  42. 'id': compat_str(media['objectId']),
  43. 'title': player_content['title'],
  44. 'description': media.get('description'),
  45. 'thumbnail': media.get('previewLink'),
  46. 'upload_date': unified_strdate(media.get('date')),
  47. 'duration': parse_duration(player_content.get('duration')),
  48. 'episode': player_content.get('episodePartName'),
  49. 'show': media.get('channel'),
  50. 'season_id': player_content.get('seasonId'),
  51. 'uploader': player_content.get('sourceCompany'),
  52. })
  53. return info