]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/aftonbladet.py
cfc7370ae43da592eaca49245200bd922d75a019
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class AftonbladetIE(InfoExtractor
):
10 _VALID_URL
= r
'^http://tv\.aftonbladet\.se/webbtv.+?(?P<video_id>article[0-9]+)\.ab(?:$|[?#])'
12 'url': 'http://tv.aftonbladet.se/webbtv/nyheter/vetenskap/rymden/article36015.ab',
16 'title': 'Vulkanutbrott i rymden - nu släpper NASA bilderna',
17 'description': 'Jupiters måne mest aktiv av alla himlakroppar',
18 'timestamp': 1394142732,
19 'upload_date': '20140306',
23 def _real_extract(self
, url
):
24 mobj
= re
.search(self
._VALID
_URL
, url
)
26 video_id
= mobj
.group('video_id')
27 webpage
= self
._download
_webpage
(url
, video_id
)
29 # find internal video meta data
30 meta_url
= 'http://aftonbladet-play.drlib.aptoma.no/video/%s.json'
31 internal_meta_id
= self
._html
_search
_regex
(
32 r
'data-aptomaId="([\w\d]+)"', webpage
, 'internal_meta_id')
33 internal_meta_url
= meta_url
% internal_meta_id
34 internal_meta_json
= self
._download
_json
(
35 internal_meta_url
, video_id
, 'Downloading video meta data')
37 # find internal video formats
38 format_url
= 'http://aftonbladet-play.videodata.drvideo.aptoma.no/actions/video/?id=%s'
39 internal_video_id
= internal_meta_json
['videoId']
40 internal_formats_url
= format_url
% internal_video_id
41 internal_formats_json
= self
._download
_json
(
42 internal_formats_url
, video_id
, 'Downloading video formats')
45 for fmt
in internal_formats_json
['formats']['http']['pseudostreaming']['mp4']:
48 'url': 'http://%s:%d/%s/%s' % (p
['address'], p
['port'], p
['path'], p
['filename']),
50 'width': fmt
['width'],
51 'height': fmt
['height'],
52 'tbr': fmt
['bitrate'],
55 self
._sort
_formats
(formats
)
59 'title': internal_meta_json
['title'],
61 'thumbnail': internal_meta_json
['imageUrl'],
62 'description': internal_meta_json
['shortPreamble'],
63 'timestamp': internal_meta_json
['timePublished'],
64 'duration': internal_meta_json
['duration'],
65 'view_count': internal_meta_json
['views'],