]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvplay.py
79863e781fd41101c76659ab3b43a85433d25665
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|
19 play\.tv3\.lt/programos|
25 tv3play\.no/programmer|
26 viasat4play\.no/programmer|
27 tv6play\.no/programmer|
28 tv3play\.dk/programmer|
29 play\.novatv\.bg/programi
34 'url': 'http://www.tvplay.lv/parraides/vinas-melo-labak/418113?autostart=true',
38 'title': 'Kādi ir īri? - Viņas melo labāk',
39 'description': 'Baiba apsmej īrus, kādi tie ir un ko viņi dara.',
41 'timestamp': 1406097056,
42 'upload_date': '20140723',
46 'skip_download': True,
50 'url': 'http://play.tv3.lt/programos/moterys-meluoja-geriau/409229?autostart=true',
54 'title': 'Moterys meluoja geriau',
55 'description': 'md5:9aec0fc68e2cbc992d2a140bd41fa89e',
57 'timestamp': 1403769181,
58 'upload_date': '20140626',
62 'skip_download': True,
66 'url': 'http://www.tv3play.ee/sisu/kodu-keset-linna/238551?autostart=true',
70 'title': 'Kodu keset linna 398537',
71 'description': 'md5:7df175e3c94db9e47c0d81ffa5d68701',
73 'timestamp': 1292449761,
74 'upload_date': '20101215',
78 'skip_download': True,
82 'url': 'http://www.tv3play.se/program/husraddarna/395385?autostart=true',
86 'title': 'Husräddarna S02E07',
87 'description': 'md5:f210c6c89f42d4fc39faa551be813777',
89 'timestamp': 1400596321,
90 'upload_date': '20140520',
94 'skip_download': True,
98 'url': 'http://www.tv6play.se/program/den-sista-dokusapan/266636?autostart=true',
102 'title': 'Den sista dokusåpan S01E08',
103 'description': 'md5:295be39c872520221b933830f660b110',
105 'timestamp': 1330522854,
106 'upload_date': '20120229',
110 'skip_download': True,
114 'url': 'http://www.tv8play.se/program/antikjakten/282756?autostart=true',
118 'title': 'Antikjakten S01E10',
119 'description': 'md5:1b201169beabd97e20c5ad0ad67b13b8',
121 'timestamp': 1348575868,
122 'upload_date': '20120925',
126 'skip_download': True,
130 'url': 'http://www.tv3play.no/programmer/anna-anka-soker-assistent/230898?autostart=true',
134 'title': 'Anna Anka søker assistent - Ep. 8',
135 'description': 'md5:f80916bf5bbe1c5f760d127f8dd71474',
137 'timestamp': 1277720005,
138 'upload_date': '20100628',
142 'skip_download': True,
146 'url': 'http://www.viasat4play.no/programmer/budbringerne/21873?autostart=true',
150 'title': 'Budbringerne program 10',
151 'description': 'md5:4db78dc4ec8a85bb04fd322a3ee5092d',
153 'timestamp': 1254205102,
154 'upload_date': '20090929',
158 'skip_download': True,
162 'url': 'http://www.tv6play.no/programmer/hotelinspektor-alex-polizzi/361883?autostart=true',
166 'title': 'Hotelinspektør Alex Polizzi - Ep. 10',
167 'description': 'md5:3ecf808db9ec96c862c8ecb3a7fdaf81',
169 'timestamp': 1393236292,
170 'upload_date': '20140224',
174 'skip_download': True,
178 'url': 'http://play.novatv.bg/programi/zdravei-bulgariya/624952?autostart=true',
182 'title': 'Здравей, България (12.06.2015 г.) ',
183 'description': 'md5:99f3700451ac5bb71a260268b8daefd7',
185 'timestamp': 1434100372,
186 'upload_date': '20150612',
190 'skip_download': True,
195 def _real_extract(self
, url
):
196 video_id
= self
._match
_id
(url
)
198 video
= self
._download
_json
(
199 'http://playapi.mtgx.tv/v1/videos/%s' % video_id
, video_id
, 'Downloading video JSON')
201 if video
['is_geo_blocked']:
203 'This content might not be available in your country due to copyright reasons')
205 streams
= self
._download
_json
(
206 'http://playapi.mtgx.tv/v1/videos/stream/%s' % video_id
, video_id
, 'Downloading streams JSON')
208 quality
= qualities(['hls', 'medium', 'high'])
210 for format_id
, video_url
in streams
['streams'].items():
211 if not video_url
or not isinstance(video_url
, compat_str
):
214 'format_id': format_id
,
215 'preference': quality(format_id
),
217 if video_url
.startswith('rtmp'):
218 m
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', video_url
)
223 'url': m
.group('url'),
224 'app': m
.group('app'),
225 'play_path': m
.group('playpath'),
227 elif video_url
.endswith('.f4m'):
228 formats
.extend(self
._extract
_f
4m
_formats
(
229 video_url
+ '?hdcore=3.5.0&plugin=aasp-3.5.0.151.81', video_id
))
237 self
._sort
_formats
(formats
)
241 'title': video
['title'],
242 'description': video
['description'],
243 'duration': video
['duration'],
244 'timestamp': parse_iso8601(video
['created_at']),
245 'view_count': video
['views']['total'],
246 'age_limit': video
.get('age_limit', 0),