You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

642 lines
22 KiB

8 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import itertools
  4. import re
  5. import random
  6. from .common import InfoExtractor
  7. from ..compat import (
  8. compat_HTTPError,
  9. compat_parse_qs,
  10. compat_str,
  11. compat_urllib_parse_urlencode,
  12. compat_urllib_parse_urlparse,
  13. )
  14. from ..utils import (
  15. clean_html,
  16. ExtractorError,
  17. int_or_none,
  18. js_to_json,
  19. orderedSet,
  20. parse_duration,
  21. parse_iso8601,
  22. update_url_query,
  23. urlencode_postdata,
  24. urljoin,
  25. )
  26. class TwitchBaseIE(InfoExtractor):
  27. _VALID_URL_BASE = r'https?://(?:(?:www|go)\.)?twitch\.tv'
  28. _API_BASE = 'https://api.twitch.tv'
  29. _USHER_BASE = 'https://usher.ttvnw.net'
  30. _LOGIN_URL = 'https://www.twitch.tv/login'
  31. _CLIENT_ID = 'jzkbprff40iqj646a697cyrvl0zt2m6'
  32. _NETRC_MACHINE = 'twitch'
  33. def _handle_error(self, response):
  34. if not isinstance(response, dict):
  35. return
  36. error = response.get('error')
  37. if error:
  38. raise ExtractorError(
  39. '%s returned error: %s - %s' % (self.IE_NAME, error, response.get('message')),
  40. expected=True)
  41. def _call_api(self, path, item_id, note):
  42. response = self._download_json(
  43. '%s/%s' % (self._API_BASE, path), item_id, note,
  44. headers={'Client-ID': self._CLIENT_ID})
  45. self._handle_error(response)
  46. return response
  47. def _real_initialize(self):
  48. self._login()
  49. def _login(self):
  50. (username, password) = self._get_login_info()
  51. if username is None:
  52. return
  53. def fail(message):
  54. raise ExtractorError(
  55. 'Unable to login. Twitch said: %s' % message, expected=True)
  56. def login_step(page, urlh, note, data):
  57. form = self._hidden_inputs(page)
  58. form.update(data)
  59. page_url = urlh.geturl()
  60. post_url = self._search_regex(
  61. r'<form[^>]+action=(["\'])(?P<url>.+?)\1', page,
  62. 'post url', default=page_url, group='url')
  63. post_url = urljoin(page_url, post_url)
  64. headers = {'Referer': page_url}
  65. try:
  66. response = self._download_json(
  67. post_url, None, note,
  68. data=urlencode_postdata(form),
  69. headers=headers)
  70. except ExtractorError as e:
  71. if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
  72. response = self._parse_json(
  73. e.cause.read().decode('utf-8'), None)
  74. fail(response['message'])
  75. raise
  76. redirect_url = urljoin(post_url, response['redirect'])
  77. return self._download_webpage_handle(
  78. redirect_url, None, 'Downloading login redirect page',
  79. headers=headers)
  80. login_page, handle = self._download_webpage_handle(
  81. self._LOGIN_URL, None, 'Downloading login page')
  82. # Some TOR nodes and public proxies are blocked completely
  83. if 'blacklist_message' in login_page:
  84. fail(clean_html(login_page))
  85. redirect_page, handle = login_step(
  86. login_page, handle, 'Logging in', {
  87. 'username': username,
  88. 'password': password,
  89. })
  90. if re.search(r'(?i)<form[^>]+id="two-factor-submit"', redirect_page) is not None:
  91. # TODO: Add mechanism to request an SMS or phone call
  92. tfa_token = self._get_tfa_info('two-factor authentication token')
  93. login_step(redirect_page, handle, 'Submitting TFA token', {
  94. 'authy_token': tfa_token,
  95. 'remember_2fa': 'true',
  96. })
  97. def _prefer_source(self, formats):
  98. try:
  99. source = next(f for f in formats if f['format_id'] == 'Source')
  100. source['preference'] = 10
  101. except StopIteration:
  102. pass # No Source stream present
  103. self._sort_formats(formats)
  104. class TwitchItemBaseIE(TwitchBaseIE):
  105. def _download_info(self, item, item_id):
  106. return self._extract_info(self._call_api(
  107. 'kraken/videos/%s%s' % (item, item_id), item_id,
  108. 'Downloading %s info JSON' % self._ITEM_TYPE))
  109. def _extract_media(self, item_id):
  110. info = self._download_info(self._ITEM_SHORTCUT, item_id)
  111. response = self._call_api(
  112. 'api/videos/%s%s' % (self._ITEM_SHORTCUT, item_id), item_id,
  113. 'Downloading %s playlist JSON' % self._ITEM_TYPE)
  114. entries = []
  115. chunks = response['chunks']
  116. qualities = list(chunks.keys())
  117. for num, fragment in enumerate(zip(*chunks.values()), start=1):
  118. formats = []
  119. for fmt_num, fragment_fmt in enumerate(fragment):
  120. format_id = qualities[fmt_num]
  121. fmt = {
  122. 'url': fragment_fmt['url'],
  123. 'format_id': format_id,
  124. 'quality': 1 if format_id == 'live' else 0,
  125. }
  126. m = re.search(r'^(?P<height>\d+)[Pp]', format_id)
  127. if m:
  128. fmt['height'] = int(m.group('height'))
  129. formats.append(fmt)
  130. self._sort_formats(formats)
  131. entry = dict(info)
  132. entry['id'] = '%s_%d' % (entry['id'], num)
  133. entry['title'] = '%s part %d' % (entry['title'], num)
  134. entry['formats'] = formats
  135. entries.append(entry)
  136. return self.playlist_result(entries, info['id'], info['title'])
  137. def _extract_info(self, info):
  138. return {
  139. 'id': info['_id'],
  140. 'title': info.get('title') or 'Untitled Broadcast',
  141. 'description': info.get('description'),
  142. 'duration': int_or_none(info.get('length')),
  143. 'thumbnail': info.get('preview'),
  144. 'uploader': info.get('channel', {}).get('display_name'),
  145. 'uploader_id': info.get('channel', {}).get('name'),
  146. 'timestamp': parse_iso8601(info.get('recorded_at')),
  147. 'view_count': int_or_none(info.get('views')),
  148. }
  149. def _real_extract(self, url):
  150. return self._extract_media(self._match_id(url))
  151. class TwitchVideoIE(TwitchItemBaseIE):
  152. IE_NAME = 'twitch:video'
  153. _VALID_URL = r'%s/[^/]+/b/(?P<id>\d+)' % TwitchBaseIE._VALID_URL_BASE
  154. _ITEM_TYPE = 'video'
  155. _ITEM_SHORTCUT = 'a'
  156. _TEST = {
  157. 'url': 'http://www.twitch.tv/riotgames/b/577357806',
  158. 'info_dict': {
  159. 'id': 'a577357806',
  160. 'title': 'Worlds Semifinals - Star Horn Royal Club vs. OMG',
  161. },
  162. 'playlist_mincount': 12,
  163. 'skip': 'HTTP Error 404: Not Found',
  164. }
  165. class TwitchChapterIE(TwitchItemBaseIE):
  166. IE_NAME = 'twitch:chapter'
  167. _VALID_URL = r'%s/[^/]+/c/(?P<id>\d+)' % TwitchBaseIE._VALID_URL_BASE
  168. _ITEM_TYPE = 'chapter'
  169. _ITEM_SHORTCUT = 'c'
  170. _TESTS = [{
  171. 'url': 'http://www.twitch.tv/acracingleague/c/5285812',
  172. 'info_dict': {
  173. 'id': 'c5285812',
  174. 'title': 'ACRL Off Season - Sports Cars @ Nordschleife',
  175. },
  176. 'playlist_mincount': 3,
  177. 'skip': 'HTTP Error 404: Not Found',
  178. }, {
  179. 'url': 'http://www.twitch.tv/tsm_theoddone/c/2349361',
  180. 'only_matching': True,
  181. }]
  182. class TwitchVodIE(TwitchItemBaseIE):
  183. IE_NAME = 'twitch:vod'
  184. _VALID_URL = r'''(?x)
  185. https?://
  186. (?:
  187. (?:(?:www|go)\.)?twitch\.tv/(?:[^/]+/v|videos)/|
  188. player\.twitch\.tv/\?.*?\bvideo=v
  189. )
  190. (?P<id>\d+)
  191. '''
  192. _ITEM_TYPE = 'vod'
  193. _ITEM_SHORTCUT = 'v'
  194. _TESTS = [{
  195. 'url': 'http://www.twitch.tv/riotgames/v/6528877?t=5m10s',
  196. 'info_dict': {
  197. 'id': 'v6528877',
  198. 'ext': 'mp4',
  199. 'title': 'LCK Summer Split - Week 6 Day 1',
  200. 'thumbnail': r're:^https?://.*\.jpg$',
  201. 'duration': 17208,
  202. 'timestamp': 1435131709,
  203. 'upload_date': '20150624',
  204. 'uploader': 'Riot Games',
  205. 'uploader_id': 'riotgames',
  206. 'view_count': int,
  207. 'start_time': 310,
  208. },
  209. 'params': {
  210. # m3u8 download
  211. 'skip_download': True,
  212. },
  213. }, {
  214. # Untitled broadcast (title is None)
  215. 'url': 'http://www.twitch.tv/belkao_o/v/11230755',
  216. 'info_dict': {
  217. 'id': 'v11230755',
  218. 'ext': 'mp4',
  219. 'title': 'Untitled Broadcast',
  220. 'thumbnail': r're:^https?://.*\.jpg$',
  221. 'duration': 1638,
  222. 'timestamp': 1439746708,
  223. 'upload_date': '20150816',
  224. 'uploader': 'BelkAO_o',
  225. 'uploader_id': 'belkao_o',
  226. 'view_count': int,
  227. },
  228. 'params': {
  229. # m3u8 download
  230. 'skip_download': True,
  231. },
  232. 'skip': 'HTTP Error 404: Not Found',
  233. }, {
  234. 'url': 'http://player.twitch.tv/?t=5m10s&video=v6528877',
  235. 'only_matching': True,
  236. }, {
  237. 'url': 'https://www.twitch.tv/videos/6528877',
  238. 'only_matching': True,
  239. }]
  240. def _real_extract(self, url):
  241. item_id = self._match_id(url)
  242. info = self._download_info(self._ITEM_SHORTCUT, item_id)
  243. access_token = self._call_api(
  244. 'api/vods/%s/access_token' % item_id, item_id,
  245. 'Downloading %s access token' % self._ITEM_TYPE)
  246. formats = self._extract_m3u8_formats(
  247. '%s/vod/%s?%s' % (
  248. self._USHER_BASE, item_id,
  249. compat_urllib_parse_urlencode({
  250. 'allow_source': 'true',
  251. 'allow_audio_only': 'true',
  252. 'allow_spectre': 'true',
  253. 'player': 'twitchweb',
  254. 'nauth': access_token['token'],
  255. 'nauthsig': access_token['sig'],
  256. })),
  257. item_id, 'mp4', entry_protocol='m3u8_native')
  258. self._prefer_source(formats)
  259. info['formats'] = formats
  260. parsed_url = compat_urllib_parse_urlparse(url)
  261. query = compat_parse_qs(parsed_url.query)
  262. if 't' in query:
  263. info['start_time'] = parse_duration(query['t'][0])
  264. if info.get('timestamp') is not None:
  265. info['subtitles'] = {
  266. 'rechat': [{
  267. 'url': update_url_query(
  268. 'https://rechat.twitch.tv/rechat-messages', {
  269. 'video_id': 'v%s' % item_id,
  270. 'start': info['timestamp'],
  271. }),
  272. 'ext': 'json',
  273. }],
  274. }
  275. return info
  276. class TwitchPlaylistBaseIE(TwitchBaseIE):
  277. _PLAYLIST_PATH = 'kraken/channels/%s/videos/?offset=%d&limit=%d'
  278. _PAGE_LIMIT = 100
  279. def _extract_playlist(self, channel_id):
  280. info = self._call_api(
  281. 'kraken/channels/%s' % channel_id,
  282. channel_id, 'Downloading channel info JSON')
  283. channel_name = info.get('display_name') or info.get('name')
  284. entries = []
  285. offset = 0
  286. limit = self._PAGE_LIMIT
  287. broken_paging_detected = False
  288. counter_override = None
  289. for counter in itertools.count(1):
  290. response = self._call_api(
  291. self._PLAYLIST_PATH % (channel_id, offset, limit),
  292. channel_id,
  293. 'Downloading %s JSON page %s'
  294. % (self._PLAYLIST_TYPE, counter_override or counter))
  295. page_entries = self._extract_playlist_page(response)
  296. if not page_entries:
  297. break
  298. total = int_or_none(response.get('_total'))
  299. # Since the beginning of March 2016 twitch's paging mechanism
  300. # is completely broken on the twitch side. It simply ignores
  301. # a limit and returns the whole offset number of videos.
  302. # Working around by just requesting all videos at once.
  303. # Upd: pagination bug was fixed by twitch on 15.03.2016.
  304. if not broken_paging_detected and total and len(page_entries) > limit:
  305. self.report_warning(
  306. 'Twitch pagination is broken on twitch side, requesting all videos at once',
  307. channel_id)
  308. broken_paging_detected = True
  309. offset = total
  310. counter_override = '(all at once)'
  311. continue
  312. entries.extend(page_entries)
  313. if broken_paging_detected or total and len(page_entries) >= total:
  314. break
  315. offset += limit
  316. return self.playlist_result(
  317. [self._make_url_result(entry) for entry in orderedSet(entries)],
  318. channel_id, channel_name)
  319. def _make_url_result(self, url):
  320. try:
  321. video_id = 'v%s' % TwitchVodIE._match_id(url)
  322. return self.url_result(url, TwitchVodIE.ie_key(), video_id=video_id)
  323. except AssertionError:
  324. return self.url_result(url)
  325. def _extract_playlist_page(self, response):
  326. videos = response.get('videos')
  327. return [video['url'] for video in videos] if videos else []
  328. def _real_extract(self, url):
  329. return self._extract_playlist(self._match_id(url))
  330. class TwitchProfileIE(TwitchPlaylistBaseIE):
  331. IE_NAME = 'twitch:profile'
  332. _VALID_URL = r'%s/(?P<id>[^/]+)/profile/?(?:\#.*)?$' % TwitchBaseIE._VALID_URL_BASE
  333. _PLAYLIST_TYPE = 'profile'
  334. _TEST = {
  335. 'url': 'http://www.twitch.tv/vanillatv/profile',
  336. 'info_dict': {
  337. 'id': 'vanillatv',
  338. 'title': 'VanillaTV',
  339. },
  340. 'playlist_mincount': 412,
  341. }
  342. class TwitchVideosBaseIE(TwitchPlaylistBaseIE):
  343. _VALID_URL_VIDEOS_BASE = r'%s/(?P<id>[^/]+)/videos' % TwitchBaseIE._VALID_URL_BASE
  344. _PLAYLIST_PATH = TwitchPlaylistBaseIE._PLAYLIST_PATH + '&broadcast_type='
  345. class TwitchAllVideosIE(TwitchVideosBaseIE):
  346. IE_NAME = 'twitch:videos:all'
  347. _VALID_URL = r'%s/all' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
  348. _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive,upload,highlight'
  349. _PLAYLIST_TYPE = 'all videos'
  350. _TEST = {
  351. 'url': 'https://www.twitch.tv/spamfish/videos/all',
  352. 'info_dict': {
  353. 'id': 'spamfish',
  354. 'title': 'Spamfish',
  355. },
  356. 'playlist_mincount': 869,
  357. }
  358. class TwitchUploadsIE(TwitchVideosBaseIE):
  359. IE_NAME = 'twitch:videos:uploads'
  360. _VALID_URL = r'%s/uploads' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
  361. _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'upload'
  362. _PLAYLIST_TYPE = 'uploads'
  363. _TEST = {
  364. 'url': 'https://www.twitch.tv/spamfish/videos/uploads',
  365. 'info_dict': {
  366. 'id': 'spamfish',
  367. 'title': 'Spamfish',
  368. },
  369. 'playlist_mincount': 0,
  370. }
  371. class TwitchPastBroadcastsIE(TwitchVideosBaseIE):
  372. IE_NAME = 'twitch:videos:past-broadcasts'
  373. _VALID_URL = r'%s/past-broadcasts' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
  374. _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive'
  375. _PLAYLIST_TYPE = 'past broadcasts'
  376. _TEST = {
  377. 'url': 'https://www.twitch.tv/spamfish/videos/past-broadcasts',
  378. 'info_dict': {
  379. 'id': 'spamfish',
  380. 'title': 'Spamfish',
  381. },
  382. 'playlist_mincount': 0,
  383. }
  384. class TwitchHighlightsIE(TwitchVideosBaseIE):
  385. IE_NAME = 'twitch:videos:highlights'
  386. _VALID_URL = r'%s/highlights' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
  387. _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'highlight'
  388. _PLAYLIST_TYPE = 'highlights'
  389. _TEST = {
  390. 'url': 'https://www.twitch.tv/spamfish/videos/highlights',
  391. 'info_dict': {
  392. 'id': 'spamfish',
  393. 'title': 'Spamfish',
  394. },
  395. 'playlist_mincount': 805,
  396. }
  397. class TwitchStreamIE(TwitchBaseIE):
  398. IE_NAME = 'twitch:stream'
  399. _VALID_URL = r'''(?x)
  400. https?://
  401. (?:
  402. (?:(?:www|go)\.)?twitch\.tv/|
  403. player\.twitch\.tv/\?.*?\bchannel=
  404. )
  405. (?P<id>[^/#?]+)
  406. '''
  407. _TESTS = [{
  408. 'url': 'http://www.twitch.tv/shroomztv',
  409. 'info_dict': {
  410. 'id': '12772022048',
  411. 'display_id': 'shroomztv',
  412. 'ext': 'mp4',
  413. 'title': 're:^ShroomzTV [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
  414. 'description': 'H1Z1 - lonewolfing with ShroomzTV | A3 Battle Royale later - @ShroomzTV',
  415. 'is_live': True,
  416. 'timestamp': 1421928037,
  417. 'upload_date': '20150122',
  418. 'uploader': 'ShroomzTV',
  419. 'uploader_id': 'shroomztv',
  420. 'view_count': int,
  421. },
  422. 'params': {
  423. # m3u8 download
  424. 'skip_download': True,
  425. },
  426. }, {
  427. 'url': 'http://www.twitch.tv/miracle_doto#profile-0',
  428. 'only_matching': True,
  429. }, {
  430. 'url': 'https://player.twitch.tv/?channel=lotsofs',
  431. 'only_matching': True,
  432. }, {
  433. 'url': 'https://go.twitch.tv/food',
  434. 'only_matching': True,
  435. }]
  436. @classmethod
  437. def suitable(cls, url):
  438. return (False
  439. if any(ie.suitable(url) for ie in (
  440. TwitchVideoIE,
  441. TwitchChapterIE,
  442. TwitchVodIE,
  443. TwitchProfileIE,
  444. TwitchAllVideosIE,
  445. TwitchUploadsIE,
  446. TwitchPastBroadcastsIE,
  447. TwitchHighlightsIE))
  448. else super(TwitchStreamIE, cls).suitable(url))
  449. def _real_extract(self, url):
  450. channel_id = self._match_id(url)
  451. stream = self._call_api(
  452. 'kraken/streams/%s?stream_type=all' % channel_id, channel_id,
  453. 'Downloading stream JSON').get('stream')
  454. if not stream:
  455. raise ExtractorError('%s is offline' % channel_id, expected=True)
  456. # Channel name may be typed if different case than the original channel name
  457. # (e.g. http://www.twitch.tv/TWITCHPLAYSPOKEMON) that will lead to constructing
  458. # an invalid m3u8 URL. Working around by use of original channel name from stream
  459. # JSON and fallback to lowercase if it's not available.
  460. channel_id = stream.get('channel', {}).get('name') or channel_id.lower()
  461. access_token = self._call_api(
  462. 'api/channels/%s/access_token' % channel_id, channel_id,
  463. 'Downloading channel access token')
  464. query = {
  465. 'allow_source': 'true',
  466. 'allow_audio_only': 'true',
  467. 'allow_spectre': 'true',
  468. 'p': random.randint(1000000, 10000000),
  469. 'player': 'twitchweb',
  470. 'segment_preference': '4',
  471. 'sig': access_token['sig'].encode('utf-8'),
  472. 'token': access_token['token'].encode('utf-8'),
  473. }
  474. formats = self._extract_m3u8_formats(
  475. '%s/api/channel/hls/%s.m3u8?%s'
  476. % (self._USHER_BASE, channel_id, compat_urllib_parse_urlencode(query)),
  477. channel_id, 'mp4')
  478. self._prefer_source(formats)
  479. view_count = stream.get('viewers')
  480. timestamp = parse_iso8601(stream.get('created_at'))
  481. channel = stream['channel']
  482. title = self._live_title(channel.get('display_name') or channel.get('name'))
  483. description = channel.get('status')
  484. thumbnails = []
  485. for thumbnail_key, thumbnail_url in stream['preview'].items():
  486. m = re.search(r'(?P<width>\d+)x(?P<height>\d+)\.jpg$', thumbnail_key)
  487. if not m:
  488. continue
  489. thumbnails.append({
  490. 'url': thumbnail_url,
  491. 'width': int(m.group('width')),
  492. 'height': int(m.group('height')),
  493. })
  494. return {
  495. 'id': compat_str(stream['_id']),
  496. 'display_id': channel_id,
  497. 'title': title,
  498. 'description': description,
  499. 'thumbnails': thumbnails,
  500. 'uploader': channel.get('display_name'),
  501. 'uploader_id': channel.get('name'),
  502. 'timestamp': timestamp,
  503. 'view_count': view_count,
  504. 'formats': formats,
  505. 'is_live': True,
  506. }
  507. class TwitchClipsIE(InfoExtractor):
  508. IE_NAME = 'twitch:clips'
  509. _VALID_URL = r'https?://clips\.twitch\.tv/(?:[^/]+/)*(?P<id>[^/?#&]+)'
  510. _TESTS = [{
  511. 'url': 'https://clips.twitch.tv/ea/AggressiveCobraPoooound',
  512. 'md5': '761769e1eafce0ffebfb4089cb3847cd',
  513. 'info_dict': {
  514. 'id': 'AggressiveCobraPoooound',
  515. 'ext': 'mp4',
  516. 'title': 'EA Play 2016 Live from the Novo Theatre',
  517. 'thumbnail': r're:^https?://.*\.jpg',
  518. 'creator': 'EA',
  519. 'uploader': 'stereotype_',
  520. 'uploader_id': 'stereotype_',
  521. },
  522. }, {
  523. # multiple formats
  524. 'url': 'https://clips.twitch.tv/rflegendary/UninterestedBeeDAESuppy',
  525. 'only_matching': True,
  526. }]
  527. def _real_extract(self, url):
  528. video_id = self._match_id(url)
  529. webpage = self._download_webpage(url, video_id)
  530. clip = self._parse_json(
  531. self._search_regex(
  532. r'(?s)clipInfo\s*=\s*({.+?});', webpage, 'clip info'),
  533. video_id, transform_source=js_to_json)
  534. title = clip.get('title') or clip.get('channel_title') or self._og_search_title(webpage)
  535. formats = [{
  536. 'url': option['source'],
  537. 'format_id': option.get('quality'),
  538. 'height': int_or_none(option.get('quality')),
  539. } for option in clip.get('quality_options', []) if option.get('source')]
  540. if not formats:
  541. formats = [{
  542. 'url': clip['clip_video_url'],
  543. }]
  544. self._sort_formats(formats)
  545. return {
  546. 'id': video_id,
  547. 'title': title,
  548. 'thumbnail': self._og_search_thumbnail(webpage),
  549. 'creator': clip.get('broadcaster_display_name') or clip.get('broadcaster_login'),
  550. 'uploader': clip.get('curator_login'),
  551. 'uploader_id': clip.get('curator_display_name'),
  552. 'formats': formats,
  553. }