]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vgtv.py
e6ee1e4715efc5d47dd3f9aa32d6559a5737a8ea
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import float_or_none
10 class VGTVIE(InfoExtractor
):
11 IE_DESC
= 'VGTV and BTTV'
20 \.no/(?:tv/)?\#!/(?:video|live)/
27 'url': 'http://www.vgtv.no/#!/video/84196/hevnen-er-soet-episode-10-abu',
28 'md5': 'b8be7a234cebb840c0d512c78013e02f',
32 'title': 'Hevnen er søt: Episode 10 - Abu',
33 'description': 'md5:e25e4badb5f544b04341e14abdc72234',
34 'thumbnail': 're:^https?://.*\.jpg',
36 'timestamp': 1404626400,
37 'upload_date': '20140706',
43 'url': 'http://www.vgtv.no/#!/live/100764/opptak-vgtv-foelger-em-kvalifiseringen',
47 'title': 'OPPTAK: VGTV følger EM-kvalifiseringen',
48 'description': 'md5:3772d9c0dc2dff92a886b60039a7d4d3',
49 'thumbnail': 're:^https?://.*\.jpg',
51 'timestamp': 1410113864,
52 'upload_date': '20140907',
57 'skip_download': True,
62 'url': 'http://www.vgtv.no/#!/live/100015/direkte-her-kan-du-se-laksen-live-fra-suldalslaagen',
66 'title': 'DIREKTE: Her kan du se laksen live fra Suldalslågen!',
67 'description': 'md5:9a60cc23fa349f761628924e56eeec2d',
68 'thumbnail': 're:^https?://.*\.jpg',
70 'timestamp': 1407423348,
71 'upload_date': '20140807',
76 'skip_download': True,
80 'url': 'http://www.bt.no/tv/#!/video/100250/norling-dette-er-forskjellen-paa-1-divisjon-og-eliteserien',
81 'only_matching': True,
85 def _real_extract(self
, url
):
86 mobj
= re
.match(self
._VALID
_URL
, url
)
87 video_id
= mobj
.group('id')
88 host
= mobj
.group('host')
95 data
= self
._download
_json
(
96 'http://svp.vg.no/svp/api/v1/%s/assets/%s?appName=%s-website'
97 % (host
, video_id
, HOST_WEBSITES
[host
]),
98 video_id
, 'Downloading media JSON')
100 streams
= data
['streamUrls']
104 hls_url
= streams
.get('hls')
106 formats
.extend(self
._extract
_m
3u8_formats
(
107 hls_url
, video_id
, 'mp4', m3u8_id
='hls'))
109 hds_url
= streams
.get('hds')
111 formats
.extend(self
._extract
_f
4m
_formats
(
112 hds_url
+ '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18',
113 video_id
, f4m_id
='hds'))
115 mp4_url
= streams
.get('mp4')
117 _url
= hls_url
or hds_url
118 MP4_URL_TEMPLATE
= '%s/%%s.%s' % (mp4_url
.rpartition('/')[0], mp4_url
.rpartition('.')[-1])
119 for mp4_format
in _url
.split(','):
120 m
= re
.search('(?P<width>\d+)_(?P<height>\d+)_(?P<vbr>\d+)', mp4_format
)
123 width
= int(m
.group('width'))
124 height
= int(m
.group('height'))
125 vbr
= int(m
.group('vbr'))
127 'url': MP4_URL_TEMPLATE
% mp4_format
,
128 'format_id': 'mp4-%s' % vbr
,
134 self
._sort
_formats
(formats
)
138 'title': data
['title'],
139 'description': data
['description'],
140 'thumbnail': data
['images']['main'] + '?t[]=900x506q80',
141 'timestamp': data
['published'],
142 'duration': float_or_none(data
['duration'], 1000),
143 'view_count': data
['displays'],
148 class BTArticleIE(InfoExtractor
):
149 IE_NAME
= 'bt:article'
150 IE_DESC
= 'Bergens Tidende Articles'
151 _VALID_URL
= 'http://(?:www\.)?bt\.no/(?:[^/]+/)+(?P<id>[^/]+)-\d+\.html'
153 'url': 'http://www.bt.no/nyheter/lokalt/Kjemper-for-internatet-1788214.html',
154 'md5': 'd055e8ee918ef2844745fcfd1a4175fb',
158 'title': 'Alrekstad internat',
159 'description': 'md5:dc81a9056c874fedb62fc48a300dac58',
160 'thumbnail': 're:^https?://.*\.jpg',
162 'timestamp': 1289991323,
163 'upload_date': '20101117',
168 def _real_extract(self
, url
):
169 webpage
= self
._download
_webpage
(url
, self
._match
_id
(url
))
170 video_id
= self
._search
_regex
(
171 r
'SVP\.Player\.load\(\s*(\d+)', webpage
, 'video id')
172 return self
.url_result('vgtv:bt:%s' % video_id
, 'VGTV')
175 class BTVestlendingenIE(InfoExtractor
):
176 IE_NAME
= 'bt:vestlendingen'
177 IE_DESC
= 'Bergens Tidende - Vestlendingen'
178 _VALID_URL
= 'http://(?:www\.)?bt\.no/spesial/vestlendingen/#!/(?P<id>\d+)'
180 'url': 'http://www.bt.no/spesial/vestlendingen/#!/86588',
181 'md5': 'd7d17e3337dc80de6d3a540aefbe441b',
185 'title': 'Otto Wollertsen',
186 'description': 'Vestlendingen Otto Fredrik Wollertsen',
187 'timestamp': 1430473209,
188 'upload_date': '20150501',
192 def _real_extract(self
, url
):
193 return self
.url_result('xstream:btno:%s' % self
._match
_id
(url
), 'Xstream')