-# coding: utf-8
-from __future__ import unicode_literals
-
import json
import re
},
'params': {
'skip_download': 'm3u8 download',
- }
+ },
}, {
'note': 'DRM-protected video',
'url': 'http://www.mewatch.sg/en/movies/dug-s-special-mission/341413',
},
'params': {
'skip_download': 'DRM-protected wvm download',
- }
+ },
}, {
# this also tests correct video id extraction
'note': 'm3u8 links are geo-restricted, but Android/mp4 is okay',
'params': {
'skip_download': 'DRM-protected wvm download',
},
- 'skip': 'm3u8 links are geo-restricted'
+ 'skip': 'm3u8 links are geo-restricted',
}, {
'url': 'http://video.toggle.sg/en/clips/seraph-sun-aloysius-will-suddenly-sing-some-old-songs-in-high-pitch-on-set/343331',
'only_matching': True,
'LocaleLanguage': '',
'LocaleCountry': '',
'LocaleDevice': '',
- 'LocaleUserState': 0
+ 'LocaleUserState': 0,
},
'Platform': 0,
'SiteGuid': 0,
'DomainID': '0',
'UDID': '',
'ApiUser': self._API_USER,
- 'ApiPass': self._API_PASS
+ 'ApiPass': self._API_PASS,
},
'MediaID': video_id,
'mediaType': 0,
info = self._download_json(
'http://tvpapi.as.tvinci.com/v2_9/gateways/jsonpostgw.aspx?m=GetMediaInfo',
- video_id, 'Downloading video info json', data=json.dumps(params).encode('utf-8'))
+ video_id, 'Downloading video info json', data=json.dumps(params).encode())
title = info['MediaName']
if ext == 'm3u8':
m3u8_formats = self._extract_m3u8_formats(
video_url, video_id, ext='mp4', m3u8_id=vid_format,
- note='Downloading %s m3u8 information' % vid_format,
- errnote='Failed to download %s m3u8 information' % vid_format,
+ note=f'Downloading {vid_format} m3u8 information',
+ errnote=f'Failed to download {vid_format} m3u8 information',
fatal=False)
for f in m3u8_formats:
# Apple FairPlay Streaming
elif ext == 'mpd':
formats.extend(self._extract_mpd_formats(
video_url, video_id, mpd_id=vid_format,
- note='Downloading %s MPD manifest' % vid_format,
- errnote='Failed to download %s MPD manifest' % vid_format,
+ note=f'Downloading {vid_format} MPD manifest',
+ errnote=f'Failed to download {vid_format} MPD manifest',
fatal=False))
elif ext == 'ism':
formats.extend(self._extract_ism_formats(
video_url, video_id, ism_id=vid_format,
- note='Downloading %s ISM manifest' % vid_format,
- errnote='Failed to download %s ISM manifest' % vid_format,
+ note=f'Downloading {vid_format} ISM manifest',
+ errnote=f'Failed to download {vid_format} ISM manifest',
fatal=False))
elif ext == 'mp4':
formats.append({
})
if not formats:
for meta in (info.get('Metas') or []):
- if (not self._downloader.params.get('allow_unplayable_formats')
+ if (not self.get_param('allow_unplayable_formats')
and meta.get('Key') == 'Encryption' and meta.get('Value') == '1'):
- self.raise_no_formats(
- 'This video is DRM protected.', expected=True)
+ self.report_drm(video_id)
# Most likely because geo-blocked if no formats and no DRM
- self._sort_formats(formats)
thumbnails = []
for picture in info.get('Pictures', []):