]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvplay.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
14 class TVPlayIE(InfoExtractor
):
15 IE_DESC
= 'TV3Play and related services'
16 _VALID_URL
= r
'''(?x)http://(?:www\.)?
17 (?:tvplay\.lv/parraides|
18 tv3play\.lt/programos|
24 tv3play\.no/programmer|
25 viasat4play\.no/programmer|
26 tv6play\.no/programmer|
27 tv3play\.dk/programmer|
32 'url': 'http://www.tvplay.lv/parraides/vinas-melo-labak/418113?autostart=true',
36 'title': 'Kādi ir īri? - Viņas melo labāk',
37 'description': 'Baiba apsmej īrus, kādi tie ir un ko viņi dara.',
39 'timestamp': 1406097056,
40 'upload_date': '20140723',
44 'skip_download': True,
48 'url': 'http://www.tv3play.lt/programos/moterys-meluoja-geriau/409229?autostart=true',
52 'title': 'Moterys meluoja geriau',
53 'description': 'md5:9aec0fc68e2cbc992d2a140bd41fa89e',
55 'timestamp': 1403769181,
56 'upload_date': '20140626',
60 'skip_download': True,
64 'url': 'http://www.tv3play.ee/sisu/kodu-keset-linna/238551?autostart=true',
68 'title': 'Kodu keset linna 398537',
69 'description': 'md5:7df175e3c94db9e47c0d81ffa5d68701',
71 'timestamp': 1292449761,
72 'upload_date': '20101215',
76 'skip_download': True,
80 'url': 'http://www.tv3play.se/program/husraddarna/395385?autostart=true',
84 'title': 'Husräddarna S02E07',
85 'description': 'md5:f210c6c89f42d4fc39faa551be813777',
87 'timestamp': 1400596321,
88 'upload_date': '20140520',
92 'skip_download': True,
96 'url': 'http://www.tv6play.se/program/den-sista-dokusapan/266636?autostart=true',
100 'title': 'Den sista dokusåpan S01E08',
101 'description': 'md5:295be39c872520221b933830f660b110',
103 'timestamp': 1330522854,
104 'upload_date': '20120229',
108 'skip_download': True,
112 'url': 'http://www.tv8play.se/program/antikjakten/282756?autostart=true',
116 'title': 'Antikjakten S01E10',
117 'description': 'md5:1b201169beabd97e20c5ad0ad67b13b8',
119 'timestamp': 1348575868,
120 'upload_date': '20120925',
124 'skip_download': True,
128 'url': 'http://www.tv3play.no/programmer/anna-anka-soker-assistent/230898?autostart=true',
132 'title': 'Anna Anka søker assistent - Ep. 8',
133 'description': 'md5:f80916bf5bbe1c5f760d127f8dd71474',
135 'timestamp': 1277720005,
136 'upload_date': '20100628',
140 'skip_download': True,
144 'url': 'http://www.viasat4play.no/programmer/budbringerne/21873?autostart=true',
148 'title': 'Budbringerne program 10',
149 'description': 'md5:4db78dc4ec8a85bb04fd322a3ee5092d',
151 'timestamp': 1254205102,
152 'upload_date': '20090929',
156 'skip_download': True,
160 'url': 'http://www.tv6play.no/programmer/hotelinspektor-alex-polizzi/361883?autostart=true',
164 'title': 'Hotelinspektør Alex Polizzi - Ep. 10',
165 'description': 'md5:3ecf808db9ec96c862c8ecb3a7fdaf81',
167 'timestamp': 1393236292,
168 'upload_date': '20140224',
172 'skip_download': True,
177 def _real_extract(self
, url
):
178 video_id
= self
._match
_id
(url
)
180 video
= self
._download
_json
(
181 'http://playapi.mtgx.tv/v1/videos/%s' % video_id
, video_id
, 'Downloading video JSON')
183 if video
['is_geo_blocked']:
185 'This content might not be available in your country due to copyright reasons')
187 streams
= self
._download
_json
(
188 'http://playapi.mtgx.tv/v1/videos/stream/%s' % video_id
, video_id
, 'Downloading streams JSON')
190 quality
= qualities(['hls', 'medium', 'high'])
192 for format_id
, video_url
in streams
['streams'].items():
193 if not video_url
or not isinstance(video_url
, compat_str
):
196 'format_id': format_id
,
197 'preference': quality(format_id
),
199 if video_url
.startswith('rtmp'):
200 m
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', video_url
)
205 'url': m
.group('url'),
206 'app': m
.group('app'),
207 'play_path': m
.group('playpath'),
209 elif video_url
.endswith('.f4m'):
210 formats
.extend(self
._extract
_f
4m
_formats
(
211 video_url
+ '?hdcore=3.5.0&plugin=aasp-3.5.0.151.81', video_id
))
219 self
._sort
_formats
(formats
)
223 'title': video
['title'],
224 'description': video
['description'],
225 'duration': video
['duration'],
226 'timestamp': parse_iso8601(video
['created_at']),
227 'view_count': video
['views']['total'],
228 'age_limit': video
.get('age_limit', 0),