]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/aftonbladet.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
7 class AftonbladetIE(InfoExtractor
):
8 _VALID_URL
= r
'http://tv\.aftonbladet\.se/webbtv.+?(?P<id>article[0-9]+)\.ab(?:$|[?#])'
10 'url': 'http://tv.aftonbladet.se/webbtv/nyheter/vetenskap/rymden/article36015.ab',
14 'title': 'Vulkanutbrott i rymden - nu släpper NASA bilderna',
15 'description': 'Jupiters måne mest aktiv av alla himlakroppar',
16 'timestamp': 1394142732,
17 'upload_date': '20140306',
21 def _real_extract(self
, url
):
22 video_id
= self
._match
_id
(url
)
23 webpage
= self
._download
_webpage
(url
, video_id
)
25 # find internal video meta data
26 meta_url
= 'http://aftonbladet-play.drlib.aptoma.no/video/%s.json'
27 internal_meta_id
= self
._html
_search
_regex
(
28 r
'data-aptomaId="([\w\d]+)"', webpage
, 'internal_meta_id')
29 internal_meta_url
= meta_url
% internal_meta_id
30 internal_meta_json
= self
._download
_json
(
31 internal_meta_url
, video_id
, 'Downloading video meta data')
33 # find internal video formats
34 format_url
= 'http://aftonbladet-play.videodata.drvideo.aptoma.no/actions/video/?id=%s'
35 internal_video_id
= internal_meta_json
['videoId']
36 internal_formats_url
= format_url
% internal_video_id
37 internal_formats_json
= self
._download
_json
(
38 internal_formats_url
, video_id
, 'Downloading video formats')
41 for fmt
in internal_formats_json
['formats']['http']['pseudostreaming']['mp4']:
44 'url': 'http://%s:%d/%s/%s' % (p
['address'], p
['port'], p
['path'], p
['filename']),
46 'width': fmt
['width'],
47 'height': fmt
['height'],
48 'tbr': fmt
['bitrate'],
51 self
._sort
_formats
(formats
)
55 'title': internal_meta_json
['title'],
57 'thumbnail': internal_meta_json
['imageUrl'],
58 'description': internal_meta_json
['shortPreamble'],
59 'timestamp': internal_meta_json
['timePublished'],
60 'duration': internal_meta_json
['duration'],
61 'view_count': internal_meta_json
['views'],