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.

549 lines
22 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import hashlib
  4. import itertools
  5. import re
  6. from .common import InfoExtractor, SearchInfoExtractor
  7. from ..compat import (
  8. compat_str,
  9. compat_urllib_parse,
  10. )
  11. from ..utils import (
  12. clean_html,
  13. int_or_none,
  14. mimetype2ext,
  15. parse_iso8601,
  16. smuggle_url,
  17. try_get,
  18. url_or_none,
  19. )
  20. from .brightcove import BrightcoveNewIE
  21. class YahooIE(InfoExtractor):
  22. IE_DESC = 'Yahoo screen and movies'
  23. _VALID_URL = r'(?P<url>https?://(?:(?P<country>[a-zA-Z]{2}(?:-[a-zA-Z]{2})?|malaysia)\.)?(?:[\da-zA-Z_-]+\.)?yahoo\.com/(?:[^/]+/)*(?P<id>[^?&#]*-[0-9]+(?:-[a-z]+)?)\.html)'
  24. _TESTS = [{
  25. 'url': 'http://screen.yahoo.com/julian-smith-travis-legg-watch-214727115.html',
  26. 'info_dict': {
  27. 'id': '2d25e626-2378-391f-ada0-ddaf1417e588',
  28. 'ext': 'mp4',
  29. 'title': 'Julian Smith & Travis Legg Watch Julian Smith',
  30. 'description': 'Julian and Travis watch Julian Smith',
  31. 'duration': 6863,
  32. 'timestamp': 1369812016,
  33. 'upload_date': '20130529',
  34. },
  35. }, {
  36. 'url': 'https://screen.yahoo.com/community/community-sizzle-reel-203225340.html?format=embed',
  37. 'md5': '7993e572fac98e044588d0b5260f4352',
  38. 'info_dict': {
  39. 'id': '4fe78544-8d48-39d8-97cd-13f205d9fcdb',
  40. 'ext': 'mp4',
  41. 'title': "Yahoo Saves 'Community'",
  42. 'description': 'md5:4d4145af2fd3de00cbb6c1d664105053',
  43. 'duration': 170,
  44. 'timestamp': 1406838636,
  45. 'upload_date': '20140731',
  46. },
  47. }, {
  48. 'url': 'https://uk.screen.yahoo.com/editor-picks/cute-raccoon-freed-drain-using-091756545.html',
  49. 'md5': '71298482f7c64cbb7fa064e4553ff1c1',
  50. 'info_dict': {
  51. 'id': 'b3affa53-2e14-3590-852b-0e0db6cd1a58',
  52. 'ext': 'webm',
  53. 'title': 'Cute Raccoon Freed From Drain\u00a0Using Angle Grinder',
  54. 'description': 'md5:f66c890e1490f4910a9953c941dee944',
  55. 'duration': 97,
  56. 'timestamp': 1414489862,
  57. 'upload_date': '20141028',
  58. }
  59. }, {
  60. 'url': 'http://news.yahoo.com/video/china-moses-crazy-blues-104538833.html',
  61. 'md5': '88e209b417f173d86186bef6e4d1f160',
  62. 'info_dict': {
  63. 'id': 'f885cf7f-43d4-3450-9fac-46ac30ece521',
  64. 'ext': 'mp4',
  65. 'title': 'China Moses Is Crazy About the Blues',
  66. 'description': 'md5:9900ab8cd5808175c7b3fe55b979bed0',
  67. 'duration': 128,
  68. 'timestamp': 1385722202,
  69. 'upload_date': '20131129',
  70. }
  71. }, {
  72. 'url': 'https://www.yahoo.com/movies/v/true-story-trailer-173000497.html',
  73. 'md5': '2a9752f74cb898af5d1083ea9f661b58',
  74. 'info_dict': {
  75. 'id': '071c4013-ce30-3a93-a5b2-e0413cd4a9d1',
  76. 'ext': 'mp4',
  77. 'title': '\'True Story\' Trailer',
  78. 'description': 'True Story',
  79. 'duration': 150,
  80. 'timestamp': 1418919206,
  81. 'upload_date': '20141218',
  82. },
  83. }, {
  84. 'url': 'https://gma.yahoo.com/pizza-delivery-man-surprised-huge-tip-college-kids-195200785.html',
  85. 'only_matching': True,
  86. }, {
  87. 'note': 'NBC Sports embeds',
  88. 'url': 'http://sports.yahoo.com/blogs/ncaab-the-dagger/tyler-kalinoski-s-buzzer-beater-caps-davidson-s-comeback-win-185609842.html?guid=nbc_cbk_davidsonbuzzerbeater_150313',
  89. 'info_dict': {
  90. 'id': '9CsDKds0kvHI',
  91. 'ext': 'flv',
  92. 'description': 'md5:df390f70a9ba7c95ff1daace988f0d8d',
  93. 'title': 'Tyler Kalinoski hits buzzer-beater to lift Davidson',
  94. 'upload_date': '20150313',
  95. 'uploader': 'NBCU-SPORTS',
  96. 'timestamp': 1426270238,
  97. },
  98. }, {
  99. 'url': 'https://tw.news.yahoo.com/-100120367.html',
  100. 'only_matching': True,
  101. }, {
  102. # Query result is embedded in webpage, but explicit request to video API fails with geo restriction
  103. 'url': 'https://screen.yahoo.com/community/communitary-community-episode-1-ladders-154501237.html',
  104. 'md5': '4fbafb9c9b6f07aa8f870629f6671b35',
  105. 'info_dict': {
  106. 'id': '1f32853c-a271-3eef-8cb6-f6d6872cb504',
  107. 'ext': 'mp4',
  108. 'title': 'Communitary - Community Episode 1: Ladders',
  109. 'description': 'md5:8fc39608213295748e1e289807838c97',
  110. 'duration': 1646,
  111. 'timestamp': 1440436550,
  112. 'upload_date': '20150824',
  113. 'series': 'Communitary',
  114. 'season_number': 6,
  115. 'episode_number': 1,
  116. },
  117. }, {
  118. # ytwnews://cavideo/
  119. 'url': 'https://tw.video.yahoo.com/movie-tw/單車天使-中文版預-092316541.html',
  120. 'info_dict': {
  121. 'id': 'ba133ff2-0793-3510-b636-59dfe9ff6cff',
  122. 'ext': 'mp4',
  123. 'title': '單車天使 - 中文版預',
  124. 'description': '中文版預',
  125. 'timestamp': 1476696196,
  126. 'upload_date': '20161017',
  127. },
  128. 'params': {
  129. 'skip_download': True,
  130. },
  131. }, {
  132. # Contains both a Yahoo hosted video and multiple Youtube embeds
  133. 'url': 'https://www.yahoo.com/entertainment/gwen-stefani-reveals-the-pop-hit-she-passed-on-assigns-it-to-her-voice-contestant-instead-033045672.html',
  134. 'info_dict': {
  135. 'id': '46c5d95a-528f-3d03-b732-732fcadd51de',
  136. 'title': 'Gwen Stefani reveals the pop hit she passed on, assigns it to her \'Voice\' contestant instead',
  137. 'description': 'Gwen decided not to record this hit herself, but she decided it was the perfect fit for Kyndall Inskeep.',
  138. },
  139. 'playlist': [{
  140. 'info_dict': {
  141. 'id': '966d4262-4fd1-3aaa-b45b-049ca6e38ba6',
  142. 'ext': 'mp4',
  143. 'title': 'Gwen Stefani reveals she turned down one of Sia\'s best songs',
  144. 'description': 'On "The Voice" Tuesday, Gwen Stefani told Taylor Swift which Sia hit was almost hers.',
  145. 'timestamp': 1572406500,
  146. 'upload_date': '20191030',
  147. },
  148. }, {
  149. 'info_dict': {
  150. 'id': '352CFDOQrKg',
  151. 'ext': 'mp4',
  152. 'title': 'Kyndal Inskeep "Performs the Hell Out of" Sia\'s "Elastic Heart" - The Voice Knockouts 2019',
  153. 'description': 'md5:35b61e94c2ae214bc965ff4245f80d11',
  154. 'uploader': 'The Voice',
  155. 'uploader_id': 'NBCTheVoice',
  156. 'upload_date': '20191029',
  157. },
  158. }],
  159. 'params': {
  160. 'playlistend': 2,
  161. },
  162. 'expected_warnings': ['HTTP Error 404'],
  163. }, {
  164. 'url': 'https://malaysia.news.yahoo.com/video/bystanders-help-ontario-policeman-bust-190932818.html',
  165. 'only_matching': True,
  166. }, {
  167. 'url': 'https://es-us.noticias.yahoo.com/es-la-puerta-irrompible-que-110539379.html',
  168. 'only_matching': True,
  169. }, {
  170. 'url': 'https://www.yahoo.com/entertainment/v/longtime-cbs-news-60-minutes-032036500-cbs.html',
  171. 'only_matching': True,
  172. }]
  173. def _real_extract(self, url):
  174. url, country, display_id = re.match(self._VALID_URL, url).groups()
  175. if not country:
  176. country = 'us'
  177. else:
  178. country = country.split('-')[0]
  179. api_base = 'https://%s.yahoo.com/_td/api/resource/' % country
  180. for i, uuid in enumerate(['url=' + url, 'ymedia-alias=' + display_id]):
  181. content = self._download_json(
  182. api_base + 'content;getDetailView=true;uuids=["%s"]' % uuid,
  183. display_id, 'Downloading content JSON metadata', fatal=i == 1)
  184. if content:
  185. item = content['items'][0]
  186. break
  187. if item.get('type') != 'video':
  188. entries = []
  189. cover = item.get('cover') or {}
  190. if cover.get('type') == 'yvideo':
  191. cover_url = cover.get('url')
  192. if cover_url:
  193. entries.append(self.url_result(
  194. cover_url, 'Yahoo', cover.get('uuid')))
  195. for e in item.get('body', []):
  196. if e.get('type') == 'videoIframe':
  197. iframe_url = e.get('url')
  198. if not iframe_url:
  199. continue
  200. entries.append(self.url_result(iframe_url))
  201. return self.playlist_result(
  202. entries, item.get('uuid'),
  203. item.get('title'), item.get('summary'))
  204. video_id = item['uuid']
  205. video = self._download_json(
  206. api_base + 'VideoService.videos;view=full;video_ids=["%s"]' % video_id,
  207. video_id, 'Downloading video JSON metadata')[0]
  208. title = video['title']
  209. if country == 'malaysia':
  210. country = 'my'
  211. is_live = video.get('live_state') == 'live'
  212. fmts = ('m3u8',) if is_live else ('webm', 'mp4')
  213. urls = []
  214. formats = []
  215. subtitles = {}
  216. for fmt in fmts:
  217. media_obj = self._download_json(
  218. 'https://video-api.yql.yahoo.com/v1/video/sapi/streams/' + video_id,
  219. video_id, 'Downloading %s JSON metadata' % fmt,
  220. headers=self.geo_verification_headers(), query={
  221. 'format': fmt,
  222. 'region': country.upper(),
  223. })['query']['results']['mediaObj'][0]
  224. msg = media_obj.get('status', {}).get('msg')
  225. for s in media_obj.get('streams', []):
  226. host = s.get('host')
  227. path = s.get('path')
  228. if not host or not path:
  229. continue
  230. s_url = host + path
  231. if s.get('format') == 'm3u8':
  232. formats.extend(self._extract_m3u8_formats(
  233. s_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
  234. continue
  235. tbr = int_or_none(s.get('bitrate'))
  236. formats.append({
  237. 'url': s_url,
  238. 'format_id': fmt + ('-%d' % tbr if tbr else ''),
  239. 'width': int_or_none(s.get('width')),
  240. 'height': int_or_none(s.get('height')),
  241. 'tbr': tbr,
  242. 'fps': int_or_none(s.get('framerate')),
  243. })
  244. for cc in media_obj.get('closedcaptions', []):
  245. cc_url = cc.get('url')
  246. if not cc_url or cc_url in urls:
  247. continue
  248. urls.append(cc_url)
  249. subtitles.setdefault(cc.get('lang') or 'en-US', []).append({
  250. 'url': cc_url,
  251. 'ext': mimetype2ext(cc.get('content_type')),
  252. })
  253. streaming_url = video.get('streaming_url')
  254. if streaming_url and not is_live:
  255. formats.extend(self._extract_m3u8_formats(
  256. streaming_url, video_id, 'mp4',
  257. 'm3u8_native', m3u8_id='hls', fatal=False))
  258. if not formats and msg == 'geo restricted':
  259. self.raise_geo_restricted()
  260. self._sort_formats(formats)
  261. thumbnails = []
  262. for thumb in video.get('thumbnails', []):
  263. thumb_url = thumb.get('url')
  264. if not thumb_url:
  265. continue
  266. thumbnails.append({
  267. 'id': thumb.get('tag'),
  268. 'url': thumb.get('url'),
  269. 'width': int_or_none(thumb.get('width')),
  270. 'height': int_or_none(thumb.get('height')),
  271. })
  272. series_info = video.get('series_info') or {}
  273. return {
  274. 'id': video_id,
  275. 'title': self._live_title(title) if is_live else title,
  276. 'formats': formats,
  277. 'display_id': display_id,
  278. 'thumbnails': thumbnails,
  279. 'description': clean_html(video.get('description')),
  280. 'timestamp': parse_iso8601(video.get('publish_time')),
  281. 'subtitles': subtitles,
  282. 'duration': int_or_none(video.get('duration')),
  283. 'view_count': int_or_none(video.get('view_count')),
  284. 'is_live': is_live,
  285. 'series': video.get('show_name'),
  286. 'season_number': int_or_none(series_info.get('season_number')),
  287. 'episode_number': int_or_none(series_info.get('episode_number')),
  288. }
  289. class YahooSearchIE(SearchInfoExtractor):
  290. IE_DESC = 'Yahoo screen search'
  291. _MAX_RESULTS = 1000
  292. IE_NAME = 'screen.yahoo:search'
  293. _SEARCH_KEY = 'yvsearch'
  294. def _get_n_results(self, query, n):
  295. """Get a specified number of results for a query"""
  296. entries = []
  297. for pagenum in itertools.count(0):
  298. result_url = 'http://video.search.yahoo.com/search/?p=%s&fr=screen&o=js&gs=0&b=%d' % (compat_urllib_parse.quote_plus(query), pagenum * 30)
  299. info = self._download_json(result_url, query,
  300. note='Downloading results page ' + str(pagenum + 1))
  301. m = info['m']
  302. results = info['results']
  303. for (i, r) in enumerate(results):
  304. if (pagenum * 30) + i >= n:
  305. break
  306. mobj = re.search(r'(?P<url>screen\.yahoo\.com/.*?-\d*?\.html)"', r)
  307. e = self.url_result('http://' + mobj.group('url'), 'Yahoo')
  308. entries.append(e)
  309. if (pagenum * 30 + i >= n) or (m['last'] >= (m['total'] - 1)):
  310. break
  311. return {
  312. '_type': 'playlist',
  313. 'id': query,
  314. 'entries': entries,
  315. }
  316. class YahooGyaOPlayerIE(InfoExtractor):
  317. IE_NAME = 'yahoo:gyao:player'
  318. _VALID_URL = r'https?://(?:gyao\.yahoo\.co\.jp/(?:player|episode/[^/]+)|streaming\.yahoo\.co\.jp/c/y)/(?P<id>\d+/v\d+/v\d+|[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
  319. _TESTS = [{
  320. 'url': 'https://gyao.yahoo.co.jp/player/00998/v00818/v0000000000000008564/',
  321. 'info_dict': {
  322. 'id': '5993125228001',
  323. 'ext': 'mp4',
  324. 'title': 'フューリー 【字幕版】',
  325. 'description': 'md5:21e691c798a15330eda4db17a8fe45a5',
  326. 'uploader_id': '4235717419001',
  327. 'upload_date': '20190124',
  328. 'timestamp': 1548294365,
  329. },
  330. 'params': {
  331. # m3u8 download
  332. 'skip_download': True,
  333. },
  334. }, {
  335. 'url': 'https://streaming.yahoo.co.jp/c/y/01034/v00133/v0000000000000000706/',
  336. 'only_matching': True,
  337. }, {
  338. 'url': 'https://gyao.yahoo.co.jp/episode/%E3%81%8D%E3%81%AE%E3%81%86%E4%BD%95%E9%A3%9F%E3%81%B9%E3%81%9F%EF%BC%9F%20%E7%AC%AC2%E8%A9%B1%202019%2F4%2F12%E6%94%BE%E9%80%81%E5%88%86/5cb02352-b725-409e-9f8d-88f947a9f682',
  339. 'only_matching': True,
  340. }]
  341. def _real_extract(self, url):
  342. video_id = self._match_id(url).replace('/', ':')
  343. video = self._download_json(
  344. 'https://gyao.yahoo.co.jp/dam/v1/videos/' + video_id,
  345. video_id, query={
  346. 'fields': 'longDescription,title,videoId',
  347. }, headers={
  348. 'X-User-Agent': 'Unknown Pc GYAO!/2.0.0 Web',
  349. })
  350. return {
  351. '_type': 'url_transparent',
  352. 'id': video_id,
  353. 'title': video['title'],
  354. 'url': smuggle_url(
  355. 'http://players.brightcove.net/4235717419001/SyG5P0gjb_default/index.html?videoId=' + video['videoId'],
  356. {'geo_countries': ['JP']}),
  357. 'description': video.get('longDescription'),
  358. 'ie_key': BrightcoveNewIE.ie_key(),
  359. }
  360. class YahooGyaOIE(InfoExtractor):
  361. IE_NAME = 'yahoo:gyao'
  362. _VALID_URL = r'https?://(?:gyao\.yahoo\.co\.jp/(?:p|title/[^/]+)|streaming\.yahoo\.co\.jp/p/y)/(?P<id>\d+/v\d+|[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
  363. _TESTS = [{
  364. 'url': 'https://gyao.yahoo.co.jp/p/00449/v03102/',
  365. 'info_dict': {
  366. 'id': '00449:v03102',
  367. },
  368. 'playlist_count': 2,
  369. }, {
  370. 'url': 'https://streaming.yahoo.co.jp/p/y/01034/v00133/',
  371. 'only_matching': True,
  372. }, {
  373. 'url': 'https://gyao.yahoo.co.jp/title/%E3%81%97%E3%82%83%E3%81%B9%E3%81%8F%E3%82%8A007/5b025a49-b2e5-4dc7-945c-09c6634afacf',
  374. 'only_matching': True,
  375. }]
  376. def _real_extract(self, url):
  377. program_id = self._match_id(url).replace('/', ':')
  378. videos = self._download_json(
  379. 'https://gyao.yahoo.co.jp/api/programs/%s/videos' % program_id, program_id)['videos']
  380. entries = []
  381. for video in videos:
  382. video_id = video.get('id')
  383. if not video_id:
  384. continue
  385. entries.append(self.url_result(
  386. 'https://gyao.yahoo.co.jp/player/%s/' % video_id.replace(':', '/'),
  387. YahooGyaOPlayerIE.ie_key(), video_id))
  388. return self.playlist_result(entries, program_id)
  389. class YahooJapanNewsIE(InfoExtractor):
  390. IE_NAME = 'yahoo:japannews'
  391. IE_DESC = 'Yahoo! Japan News'
  392. _VALID_URL = r'https?://(?P<host>(?:news|headlines)\.yahoo\.co\.jp)[^\d]*(?P<id>\d[\d-]*\d)?'
  393. _GEO_COUNTRIES = ['JP']
  394. _TESTS = [{
  395. 'url': 'https://headlines.yahoo.co.jp/videonews/ann?a=20190716-00000071-ann-int',
  396. 'info_dict': {
  397. 'id': '1736242',
  398. 'ext': 'mp4',
  399. 'title': 'ムン大統領が対日批判を強化“現金化”効果は?(テレビ朝日系(ANN)) - Yahoo!ニュース',
  400. 'description': '韓国の元徴用工らを巡る裁判の原告が弁護士が差し押さえた三菱重工業の資産を売却して - Yahoo!ニュース(テレビ朝日系(ANN))',
  401. 'thumbnail': r're:^https?://.*\.[a-zA-Z\d]{3,4}$',
  402. },
  403. 'params': {
  404. 'skip_download': True,
  405. },
  406. }, {
  407. # geo restricted
  408. 'url': 'https://headlines.yahoo.co.jp/hl?a=20190721-00000001-oxv-l04',
  409. 'only_matching': True,
  410. }, {
  411. 'url': 'https://headlines.yahoo.co.jp/videonews/',
  412. 'only_matching': True,
  413. }, {
  414. 'url': 'https://news.yahoo.co.jp',
  415. 'only_matching': True,
  416. }, {
  417. 'url': 'https://news.yahoo.co.jp/byline/hashimotojunji/20190628-00131977/',
  418. 'only_matching': True,
  419. }, {
  420. 'url': 'https://news.yahoo.co.jp/feature/1356',
  421. 'only_matching': True
  422. }]
  423. def _extract_formats(self, json_data, content_id):
  424. formats = []
  425. video_data = try_get(
  426. json_data,
  427. lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
  428. list)
  429. for vid in video_data or []:
  430. delivery = vid.get('delivery')
  431. url = url_or_none(vid.get('Url'))
  432. if not delivery or not url:
  433. continue
  434. elif delivery == 'hls':
  435. formats.extend(
  436. self._extract_m3u8_formats(
  437. url, content_id, 'mp4', 'm3u8_native',
  438. m3u8_id='hls', fatal=False))
  439. else:
  440. formats.append({
  441. 'url': url,
  442. 'format_id': 'http-%s' % compat_str(vid.get('bitrate', '')),
  443. 'height': int_or_none(vid.get('height')),
  444. 'width': int_or_none(vid.get('width')),
  445. 'tbr': int_or_none(vid.get('bitrate')),
  446. })
  447. self._remove_duplicate_formats(formats)
  448. self._sort_formats(formats)
  449. return formats
  450. def _real_extract(self, url):
  451. mobj = re.match(self._VALID_URL, url)
  452. host = mobj.group('host')
  453. display_id = mobj.group('id') or host
  454. webpage = self._download_webpage(url, display_id)
  455. title = self._html_search_meta(
  456. ['og:title', 'twitter:title'], webpage, 'title', default=None
  457. ) or self._html_search_regex('<title>([^<]+)</title>', webpage, 'title')
  458. if display_id == host:
  459. # Headline page (w/ multiple BC playlists) ('news.yahoo.co.jp', 'headlines.yahoo.co.jp/videonews/', ...)
  460. stream_plists = re.findall(r'plist=(\d+)', webpage) or re.findall(r'plist["\']:\s*["\']([^"\']+)', webpage)
  461. entries = [
  462. self.url_result(
  463. smuggle_url(
  464. 'http://players.brightcove.net/5690807595001/HyZNerRl7_default/index.html?playlistId=%s' % plist_id,
  465. {'geo_countries': ['JP']}),
  466. ie='BrightcoveNew', video_id=plist_id)
  467. for plist_id in stream_plists]
  468. return self.playlist_result(entries, playlist_title=title)
  469. # Article page
  470. description = self._html_search_meta(
  471. ['og:description', 'description', 'twitter:description'],
  472. webpage, 'description', default=None)
  473. thumbnail = self._og_search_thumbnail(
  474. webpage, default=None) or self._html_search_meta(
  475. 'twitter:image', webpage, 'thumbnail', default=None)
  476. space_id = self._search_regex([
  477. r'<script[^>]+class=["\']yvpub-player["\'][^>]+spaceid=([^&"\']+)',
  478. r'YAHOO\.JP\.srch\.\w+link\.onLoad[^;]+spaceID["\' ]*:["\' ]+([^"\']+)',
  479. r'<!--\s+SpaceID=(\d+)'
  480. ], webpage, 'spaceid')
  481. content_id = self._search_regex(
  482. r'<script[^>]+class=["\']yvpub-player["\'][^>]+contentid=(?P<contentid>[^&"\']+)',
  483. webpage, 'contentid', group='contentid')
  484. json_data = self._download_json(
  485. 'https://feapi-yvpub.yahooapis.jp/v1/content/%s' % content_id,
  486. content_id,
  487. query={
  488. 'appid': 'dj0zaiZpPVZMTVFJR0FwZWpiMyZzPWNvbnN1bWVyc2VjcmV0Jng9YjU-',
  489. 'output': 'json',
  490. 'space_id': space_id,
  491. 'domain': host,
  492. 'ak': hashlib.md5('_'.join((space_id, host)).encode()).hexdigest(),
  493. 'device_type': '1100',
  494. })
  495. formats = self._extract_formats(json_data, content_id)
  496. return {
  497. 'id': content_id,
  498. 'title': title,
  499. 'description': description,
  500. 'thumbnail': thumbnail,
  501. 'formats': formats,
  502. }