]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/puls4.py
fca30e1aae5b35f9ef439fccc8396b5127f79aa9
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class Puls4IE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?puls4\.com/video/[^/]+/play/(?P<id>[0-9]+)'
15 'url': 'http://www.puls4.com/video/pro-und-contra/play/2716816',
16 'md5': '49f6a6629747eeec43cef6a46b5df81d',
20 'title': 'Pro und Contra vom 23.02.2015',
21 'description': 'md5:293e44634d9477a67122489994675db6',
23 'upload_date': '20150224',
26 'skip': 'Only works from Germany',
28 'url': 'http://www.puls4.com/video/kult-spielfilme/play/1298106',
29 'md5': '6a48316c8903ece8dab9b9a7bf7a59ec',
33 'title': 'Lucky Fritz',
35 'skip': 'Only works from Germany',
38 def _real_extract(self
, url
):
39 video_id
= self
._match
_id
(url
)
40 webpage
= self
._download
_webpage
(url
, video_id
)
42 error_message
= self
._html
_search
_regex
(
43 r
'<div[^>]+class="message-error"[^>]*>(.+?)</div>',
44 webpage
, 'error message', default
=None)
47 '%s returned error: %s' % (self
.IE_NAME
, error_message
), expected
=True)
49 real_url
= self
._html
_search
_regex
(
50 r
'\"fsk-button\".+?href=\"([^"]+)',
51 webpage
, 'fsk_button', default
=None)
53 webpage
= self
._download
_webpage
(real_url
, video_id
)
55 player
= self
._search
_regex
(
56 r
'p4_video_player(?:_iframe)?\("video_\d+_container"\s*,(.+?)\);\s*\}',
59 player_json
= self
._parse
_json
(
60 '[%s]' % player
, video_id
,
61 transform_source
=lambda s
: s
.replace('undefined,', ''))
67 if isinstance(v
, list) and not formats
:
70 'format': 'hd' if f
.get('hd') else 'sd',
71 'width': int_or_none(f
.get('size_x')),
72 'height': int_or_none(f
.get('size_y')),
73 'tbr': int_or_none(f
.get('bitrate')),
75 self
._sort
_formats
(formats
)
76 elif isinstance(v
, dict) and not result
:
79 'title': v
['videopartname'].strip(),
80 'description': v
.get('videotitle'),
81 'duration': int_or_none(v
.get('videoduration') or v
.get('episodeduration')),
82 'upload_date': unified_strdate(v
.get('clipreleasetime')),
83 'uploader': v
.get('channel'),
86 result
['formats'] = formats