]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/noco.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class NocoIE(InfoExtractor
):
15 _VALID_URL
= r
'http://(?:(?:www\.)?noco\.tv/emission/|player\.noco\.tv/\?idvideo=)(?P<id>\d+)'
18 'url': 'http://noco.tv/emission/11538/nolife/ami-ami-idol-hello-france/',
19 'md5': '0a993f0058ddbcd902630b2047ef710e',
23 'title': 'Ami Ami Idol - Hello! France',
24 'description': 'md5:4eaab46ab68fa4197a317a88a53d3b86',
25 'upload_date': '20140412',
30 'skip': 'Requires noco account',
33 def _real_extract(self
, url
):
34 mobj
= re
.match(self
._VALID
_URL
, url
)
35 video_id
= mobj
.group('id')
37 medias
= self
._download
_json
(
38 'https://api.noco.tv/1.0/video/medias/%s' % video_id
, video_id
, 'Downloading video JSON')
42 for fmt
in medias
['fr']['video_list']['default']['quality_list']:
43 format_id
= fmt
['quality_key']
45 file = self
._download
_json
(
46 'https://api.noco.tv/1.0/video/file/%s/fr/%s' % (format_id
.lower(), video_id
),
47 video_id
, 'Downloading %s video JSON' % format_id
)
49 file_url
= file['file']
53 if file_url
== 'forbidden':
55 '%s returned error: %s - %s' % (
56 self
.IE_NAME
, file['popmessage']['title'], file['popmessage']['message']),
61 'format_id': format_id
,
62 'width': fmt
['res_width'],
63 'height': fmt
['res_lines'],
64 'abr': fmt
['audiobitrate'],
65 'vbr': fmt
['videobitrate'],
66 'filesize': fmt
['filesize'],
67 'format_note': fmt
['quality_name'],
68 'preference': fmt
['priority'],
71 self
._sort
_formats
(formats
)
73 show
= self
._download
_json
(
74 'https://api.noco.tv/1.0/shows/show/%s' % video_id
, video_id
, 'Downloading show JSON')[0]
76 upload_date
= unified_strdate(show
['indexed'])
77 uploader
= show
['partner_name']
78 uploader_id
= show
['partner_key']
79 duration
= show
['duration_ms'] / 1000.0
80 thumbnail
= show
['screenshot']
82 episode
= show
.get('show_TT') or show
.get('show_OT')
83 family
= show
.get('family_TT') or show
.get('family_OT')
84 episode_number
= show
.get('episode_number')
90 title
+= ' #' + compat_str(episode_number
)
92 title
+= ' - ' + episode
94 description
= show
.get('show_resume') or show
.get('family_resume')
99 'description': description
,
100 'thumbnail': thumbnail
,
101 'upload_date': upload_date
,
102 'uploader': uploader
,
103 'uploader_id': uploader_id
,
104 'duration': duration
,