- 'title': 'Cooking with Shin 4512.1',
- 'description': 'md5:a8eec7942e1664a6896fcd5e1287bfd0',
- 'thumbnail': 're:^https?://.*\.jpg',
- 'timestamp': 1404336058,
- 'upload_date': '20140702',
- 'duration': 343,
- }
- }
+ 'title': 'Mnet Asian Music Awards 2015',
+ 'description': 'md5:3ff2ee8fedaef86e076791c909cf2e91',
+ 'episode': 'Mnet Asian Music Awards 2015 - Part 3',
+ 'episode_number': 4,
+ 'thumbnail': r're:^https?://.*\.jpg',
+ 'timestamp': 1450213200,
+ 'upload_date': '20151215',
+ 'duration': 5359,
+ },
+ 'params': {
+ # m3u8 download
+ 'skip_download': True,
+ },
+ }, {
+ 'url': 'https://www.dramafever.com/zh-cn/drama/4972/15/Doctor_Romantic/',
+ 'only_matching': True,
+ }]
+
+ def _call_api(self, path, video_id, note, fatal=False):
+ return self._download_json(
+ 'https://www.dramafever.com/api/5/' + path,
+ video_id, note=note, headers={
+ 'x-consumer-key': self._consumer_secret,
+ }, fatal=fatal)
+
+ def _get_subtitles(self, video_id):
+ subtitles = {}
+ subs = self._call_api(
+ 'video/%s/subtitles/webvtt/' % video_id, video_id,
+ 'Downloading subtitles JSON', fatal=False)
+ if not subs or not isinstance(subs, list):
+ return subtitles
+ for sub in subs:
+ if not isinstance(sub, dict):
+ continue
+ sub_url = sub.get('url')
+ if not sub_url or not isinstance(sub_url, compat_str):
+ continue
+ subtitles.setdefault(
+ sub.get('code') or sub.get('language') or 'en', []).append({
+ 'url': sub_url
+ })
+ return subtitles