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.

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