]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/azubu.py
0961d339fd09b15cc867377db6650b08064a0f25
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..utils
import float_or_none
9 class AzubuIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?azubu\.tv/[^/]+#!/play/(?P<id>\d+)'
13 'url': 'http://www.azubu.tv/GSL#!/play/15575/2014-hot6-cup-last-big-match-ro8-day-1',
14 'md5': 'a88b42fcf844f29ad6035054bd9ecaf4',
18 'title': '2014 HOT6 CUP LAST BIG MATCH Ro8 Day 1',
19 'description': 'md5:d06bdea27b8cc4388a90ad35b5c66c01',
20 'thumbnail': 're:^https?://.*\.jpe?g',
21 'timestamp': 1417523507.334,
22 'upload_date': '20141202',
25 'uploader_id': 414310,
30 'url': 'http://www.azubu.tv/FnaticTV#!/play/9344/-fnatic-at-worlds-2014:-toyz---%22i-love-rekkles,-he-has-amazing-mechanics%22-',
31 'md5': 'b72a871fe1d9f70bd7673769cdb3b925',
35 'title': 'Fnatic at Worlds 2014: Toyz - "I love Rekkles, he has amazing mechanics"',
36 'description': 'md5:4a649737b5f6c8b5c5be543e88dc62af',
37 'thumbnail': 're:^https?://.*\.jpe?g',
38 'timestamp': 1410530893.320,
39 'upload_date': '20140912',
41 'uploader': 'FnaticTV',
42 'uploader_id': 272749,
48 def _real_extract(self
, url
):
49 video_id
= self
._match
_id
(url
)
51 data
= self
._download
_json
(
52 'http://www.azubu.tv/api/video/%s' % video_id
, video_id
)['data']
54 title
= data
['title'].strip()
55 description
= data
['description']
56 thumbnail
= data
['thumbnail']
57 view_count
= data
['view_count']
58 uploader
= data
['user']['username']
59 uploader_id
= data
['user']['id']
61 stream_params
= json
.loads(data
['stream_params'])
63 timestamp
= float_or_none(stream_params
['creationDate'], 1000)
64 duration
= float_or_none(stream_params
['length'], 1000)
66 renditions
= stream_params
.get('renditions') or []
67 video
= stream_params
.get('FLVFullLength') or stream_params
.get('videoFullLength')
69 renditions
.append(video
)
73 'width': fmt
['frameWidth'],
74 'height': fmt
['frameHeight'],
75 'vbr': float_or_none(fmt
['encodingRate'], 1000),
76 'filesize': fmt
['size'],
77 'vcodec': fmt
['videoCodec'],
78 'container': fmt
['videoContainer'],
79 } for fmt
in renditions
if fmt
['url']]
80 self
._sort
_formats
(formats
)
85 'description': description
,
86 'thumbnail': thumbnail
,
87 'timestamp': timestamp
,
90 'uploader_id': uploader_id
,
91 'view_count': view_count
,