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.

428 lines
16 KiB

10 years ago
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
10 years ago
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. import json
  5. import itertools
  6. from .common import InfoExtractor
  7. from ..utils import (
  8. determine_ext,
  9. error_to_compat_str,
  10. ExtractorError,
  11. int_or_none,
  12. parse_iso8601,
  13. sanitized_Request,
  14. str_to_int,
  15. unescapeHTML,
  16. )
  17. class DailymotionBaseInfoExtractor(InfoExtractor):
  18. @staticmethod
  19. def _build_request(url):
  20. """Build a request with the family filter disabled"""
  21. request = sanitized_Request(url)
  22. request.add_header('Cookie', 'family_filter=off; ff=off')
  23. return request
  24. def _download_webpage_handle_no_ff(self, url, *args, **kwargs):
  25. request = self._build_request(url)
  26. return self._download_webpage_handle(request, *args, **kwargs)
  27. def _download_webpage_no_ff(self, url, *args, **kwargs):
  28. request = self._build_request(url)
  29. return self._download_webpage(request, *args, **kwargs)
  30. class DailymotionIE(DailymotionBaseInfoExtractor):
  31. _VALID_URL = r'(?i)(?:https?://)?(?:(www|touch)\.)?dailymotion\.[a-z]{2,3}/(?:(?:embed|swf|#)/)?video/(?P<id>[^/?_]+)'
  32. IE_NAME = 'dailymotion'
  33. _FORMATS = [
  34. ('stream_h264_ld_url', 'ld'),
  35. ('stream_h264_url', 'standard'),
  36. ('stream_h264_hq_url', 'hq'),
  37. ('stream_h264_hd_url', 'hd'),
  38. ('stream_h264_hd1080_url', 'hd180'),
  39. ]
  40. _TESTS = [
  41. {
  42. 'url': 'https://www.dailymotion.com/video/x2iuewm_steam-machine-models-pricing-listed-on-steam-store-ign-news_videogames',
  43. 'md5': '2137c41a8e78554bb09225b8eb322406',
  44. 'info_dict': {
  45. 'id': 'x2iuewm',
  46. 'ext': 'mp4',
  47. 'title': 'Steam Machine Models, Pricing Listed on Steam Store - IGN News',
  48. 'description': 'Several come bundled with the Steam Controller.',
  49. 'thumbnail': 're:^https?:.*\.(?:jpg|png)$',
  50. 'duration': 74,
  51. 'timestamp': 1425657362,
  52. 'upload_date': '20150306',
  53. 'uploader': 'IGN',
  54. 'uploader_id': 'xijv66',
  55. 'age_limit': 0,
  56. 'view_count': int,
  57. 'comment_count': int,
  58. }
  59. },
  60. # Vevo video
  61. {
  62. 'url': 'http://www.dailymotion.com/video/x149uew_katy-perry-roar-official_musi',
  63. 'info_dict': {
  64. 'title': 'Roar (Official)',
  65. 'id': 'USUV71301934',
  66. 'ext': 'mp4',
  67. 'uploader': 'Katy Perry',
  68. 'upload_date': '20130905',
  69. },
  70. 'params': {
  71. 'skip_download': True,
  72. },
  73. 'skip': 'VEVO is only available in some countries',
  74. },
  75. # age-restricted video
  76. {
  77. 'url': 'http://www.dailymotion.com/video/xyh2zz_leanna-decker-cyber-girl-of-the-year-desires-nude-playboy-plus_redband',
  78. 'md5': '0d667a7b9cebecc3c89ee93099c4159d',
  79. 'info_dict': {
  80. 'id': 'xyh2zz',
  81. 'ext': 'mp4',
  82. 'title': 'Leanna Decker - Cyber Girl Of The Year Desires Nude [Playboy Plus]',
  83. 'uploader': 'HotWaves1012',
  84. 'age_limit': 18,
  85. }
  86. },
  87. # geo-restricted, player v5
  88. {
  89. 'url': 'http://www.dailymotion.com/video/xhza0o',
  90. 'only_matching': True,
  91. },
  92. # with subtitles
  93. {
  94. 'url': 'http://www.dailymotion.com/video/x20su5f_the-power-of-nightmares-1-the-rise-of-the-politics-of-fear-bbc-2004_news',
  95. 'only_matching': True,
  96. },
  97. {
  98. 'url': 'http://www.dailymotion.com/swf/video/x3n92nf',
  99. 'only_matching': True,
  100. }
  101. ]
  102. def _real_extract(self, url):
  103. video_id = self._match_id(url)
  104. webpage = self._download_webpage_no_ff(
  105. 'https://www.dailymotion.com/video/%s' % video_id, video_id)
  106. age_limit = self._rta_search(webpage)
  107. description = self._og_search_description(webpage) or self._html_search_meta(
  108. 'description', webpage, 'description')
  109. view_count = str_to_int(self._search_regex(
  110. [r'<meta[^>]+itemprop="interactionCount"[^>]+content="UserPlays:(\d+)"',
  111. r'video_views_count[^>]+>\s+([\d\.,]+)'],
  112. webpage, 'view count', fatal=False))
  113. comment_count = int_or_none(self._search_regex(
  114. r'<meta[^>]+itemprop="interactionCount"[^>]+content="UserComments:(\d+)"',
  115. webpage, 'comment count', fatal=False))
  116. player_v5 = self._search_regex(
  117. [r'buildPlayer\(({.+?})\);\n', # See https://github.com/rg3/youtube-dl/issues/7826
  118. r'playerV5\s*=\s*dmp\.create\([^,]+?,\s*({.+?})\);',
  119. r'buildPlayer\(({.+?})\);'],
  120. webpage, 'player v5', default=None)
  121. if player_v5:
  122. player = self._parse_json(player_v5, video_id)
  123. metadata = player['metadata']
  124. self._check_error(metadata)
  125. formats = []
  126. for quality, media_list in metadata['qualities'].items():
  127. for media in media_list:
  128. media_url = media.get('url')
  129. if not media_url:
  130. continue
  131. type_ = media.get('type')
  132. if type_ == 'application/vnd.lumberjack.manifest':
  133. continue
  134. ext = determine_ext(media_url)
  135. if type_ == 'application/x-mpegURL' or ext == 'm3u8':
  136. formats.extend(self._extract_m3u8_formats(
  137. media_url, video_id, 'mp4', preference=-1,
  138. m3u8_id='hls', fatal=False))
  139. elif type_ == 'application/f4m' or ext == 'f4m':
  140. formats.extend(self._extract_f4m_formats(
  141. media_url, video_id, preference=-1, f4m_id='hds', fatal=False))
  142. else:
  143. f = {
  144. 'url': media_url,
  145. 'format_id': 'http-%s' % quality,
  146. }
  147. m = re.search(r'H264-(?P<width>\d+)x(?P<height>\d+)', media_url)
  148. if m:
  149. f.update({
  150. 'width': int(m.group('width')),
  151. 'height': int(m.group('height')),
  152. })
  153. formats.append(f)
  154. self._sort_formats(formats)
  155. title = metadata['title']
  156. duration = int_or_none(metadata.get('duration'))
  157. timestamp = int_or_none(metadata.get('created_time'))
  158. thumbnail = metadata.get('poster_url')
  159. uploader = metadata.get('owner', {}).get('screenname')
  160. uploader_id = metadata.get('owner', {}).get('id')
  161. subtitles = {}
  162. subtitles_data = metadata.get('subtitles', {}).get('data', {})
  163. if subtitles_data and isinstance(subtitles_data, dict):
  164. for subtitle_lang, subtitle in subtitles_data.items():
  165. subtitles[subtitle_lang] = [{
  166. 'ext': determine_ext(subtitle_url),
  167. 'url': subtitle_url,
  168. } for subtitle_url in subtitle.get('urls', [])]
  169. return {
  170. 'id': video_id,
  171. 'title': title,
  172. 'description': description,
  173. 'thumbnail': thumbnail,
  174. 'duration': duration,
  175. 'timestamp': timestamp,
  176. 'uploader': uploader,
  177. 'uploader_id': uploader_id,
  178. 'age_limit': age_limit,
  179. 'view_count': view_count,
  180. 'comment_count': comment_count,
  181. 'formats': formats,
  182. 'subtitles': subtitles,
  183. }
  184. # vevo embed
  185. vevo_id = self._search_regex(
  186. r'<link rel="video_src" href="[^"]*?vevo.com[^"]*?video=(?P<id>[\w]*)',
  187. webpage, 'vevo embed', default=None)
  188. if vevo_id:
  189. return self.url_result('vevo:%s' % vevo_id, 'Vevo')
  190. # fallback old player
  191. embed_page = self._download_webpage_no_ff(
  192. 'https://www.dailymotion.com/embed/video/%s' % video_id,
  193. video_id, 'Downloading embed page')
  194. timestamp = parse_iso8601(self._html_search_meta(
  195. 'video:release_date', webpage, 'upload date'))
  196. info = self._parse_json(
  197. self._search_regex(
  198. r'var info = ({.*?}),$', embed_page,
  199. 'video info', flags=re.MULTILINE),
  200. video_id)
  201. self._check_error(info)
  202. formats = []
  203. for (key, format_id) in self._FORMATS:
  204. video_url = info.get(key)
  205. if video_url is not None:
  206. m_size = re.search(r'H264-(\d+)x(\d+)', video_url)
  207. if m_size is not None:
  208. width, height = map(int_or_none, (m_size.group(1), m_size.group(2)))
  209. else:
  210. width, height = None, None
  211. formats.append({
  212. 'url': video_url,
  213. 'ext': 'mp4',
  214. 'format_id': format_id,
  215. 'width': width,
  216. 'height': height,
  217. })
  218. self._sort_formats(formats)
  219. # subtitles
  220. video_subtitles = self.extract_subtitles(video_id, webpage)
  221. title = self._og_search_title(webpage, default=None)
  222. if title is None:
  223. title = self._html_search_regex(
  224. r'(?s)<span\s+id="video_title"[^>]*>(.*?)</span>', webpage,
  225. 'title')
  226. return {
  227. 'id': video_id,
  228. 'formats': formats,
  229. 'uploader': info['owner.screenname'],
  230. 'timestamp': timestamp,
  231. 'title': title,
  232. 'description': description,
  233. 'subtitles': video_subtitles,
  234. 'thumbnail': info['thumbnail_url'],
  235. 'age_limit': age_limit,
  236. 'view_count': view_count,
  237. 'duration': info['duration']
  238. }
  239. def _check_error(self, info):
  240. if info.get('error') is not None:
  241. raise ExtractorError(
  242. '%s said: %s' % (self.IE_NAME, info['error']['title']), expected=True)
  243. def _get_subtitles(self, video_id, webpage):
  244. try:
  245. sub_list = self._download_webpage(
  246. 'https://api.dailymotion.com/video/%s/subtitles?fields=id,language,url' % video_id,
  247. video_id, note=False)
  248. except ExtractorError as err:
  249. self._downloader.report_warning('unable to download video subtitles: %s' % error_to_compat_str(err))
  250. return {}
  251. info = json.loads(sub_list)
  252. if (info['total'] > 0):
  253. sub_lang_list = dict((l['language'], [{'url': l['url'], 'ext': 'srt'}]) for l in info['list'])
  254. return sub_lang_list
  255. self._downloader.report_warning('video doesn\'t have subtitles')
  256. return {}
  257. class DailymotionPlaylistIE(DailymotionBaseInfoExtractor):
  258. IE_NAME = 'dailymotion:playlist'
  259. _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>.+?)/'
  260. _MORE_PAGES_INDICATOR = r'(?s)<div class="pages[^"]*">.*?<a\s+class="[^"]*?icon-arrow_right[^"]*?"'
  261. _PAGE_TEMPLATE = 'https://www.dailymotion.com/playlist/%s/%s'
  262. _TESTS = [{
  263. 'url': 'http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q',
  264. 'info_dict': {
  265. 'title': 'SPORT',
  266. 'id': 'xv4bw_nqtv_sport',
  267. },
  268. 'playlist_mincount': 20,
  269. }]
  270. def _extract_entries(self, id):
  271. video_ids = set()
  272. processed_urls = set()
  273. for pagenum in itertools.count(1):
  274. page_url = self._PAGE_TEMPLATE % (id, pagenum)
  275. webpage, urlh = self._download_webpage_handle_no_ff(
  276. page_url, id, 'Downloading page %s' % pagenum)
  277. if urlh.geturl() in processed_urls:
  278. self.report_warning('Stopped at duplicated page %s, which is the same as %s' % (
  279. page_url, urlh.geturl()), id)
  280. break
  281. processed_urls.add(urlh.geturl())
  282. for video_id in re.findall(r'data-xid="(.+?)"', webpage):
  283. if video_id not in video_ids:
  284. yield self.url_result('http://www.dailymotion.com/video/%s' % video_id, 'Dailymotion')
  285. video_ids.add(video_id)
  286. if re.search(self._MORE_PAGES_INDICATOR, webpage) is None:
  287. break
  288. def _real_extract(self, url):
  289. mobj = re.match(self._VALID_URL, url)
  290. playlist_id = mobj.group('id')
  291. webpage = self._download_webpage(url, playlist_id)
  292. return {
  293. '_type': 'playlist',
  294. 'id': playlist_id,
  295. 'title': self._og_search_title(webpage),
  296. 'entries': self._extract_entries(playlist_id),
  297. }
  298. class DailymotionUserIE(DailymotionPlaylistIE):
  299. IE_NAME = 'dailymotion:user'
  300. _VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/(?!(?:embed|swf|#|video|playlist)/)(?:(?:old/)?user/)?(?P<user>[^/]+)'
  301. _PAGE_TEMPLATE = 'http://www.dailymotion.com/user/%s/%s'
  302. _TESTS = [{
  303. 'url': 'https://www.dailymotion.com/user/nqtv',
  304. 'info_dict': {
  305. 'id': 'nqtv',
  306. 'title': 'Rémi Gaillard',
  307. },
  308. 'playlist_mincount': 100,
  309. }, {
  310. 'url': 'http://www.dailymotion.com/user/UnderProject',
  311. 'info_dict': {
  312. 'id': 'UnderProject',
  313. 'title': 'UnderProject',
  314. },
  315. 'playlist_mincount': 1800,
  316. 'expected_warnings': [
  317. 'Stopped at duplicated page',
  318. ],
  319. 'skip': 'Takes too long time',
  320. }]
  321. def _real_extract(self, url):
  322. mobj = re.match(self._VALID_URL, url)
  323. user = mobj.group('user')
  324. webpage = self._download_webpage(
  325. 'https://www.dailymotion.com/user/%s' % user, user)
  326. full_user = unescapeHTML(self._html_search_regex(
  327. r'<a class="nav-image" title="([^"]+)" href="/%s">' % re.escape(user),
  328. webpage, 'user'))
  329. return {
  330. '_type': 'playlist',
  331. 'id': user,
  332. 'title': full_user,
  333. 'entries': self._extract_entries(user),
  334. }
  335. class DailymotionCloudIE(DailymotionBaseInfoExtractor):
  336. _VALID_URL_PREFIX = r'http://api\.dmcloud\.net/(?:player/)?embed/'
  337. _VALID_URL = r'%s[^/]+/(?P<id>[^/?]+)' % _VALID_URL_PREFIX
  338. _VALID_EMBED_URL = r'%s[^/]+/[^\'"]+' % _VALID_URL_PREFIX
  339. _TESTS = [{
  340. # From http://www.francetvinfo.fr/economie/entreprises/les-entreprises-familiales-le-secret-de-la-reussite_933271.html
  341. # Tested at FranceTvInfo_2
  342. 'url': 'http://api.dmcloud.net/embed/4e7343f894a6f677b10006b4/556e03339473995ee145930c?auth=1464865870-0-jyhsm84b-ead4c701fb750cf9367bf4447167a3db&autoplay=1',
  343. 'only_matching': True,
  344. }, {
  345. # http://www.francetvinfo.fr/societe/larguez-les-amarres-le-cobaturage-se-developpe_980101.html
  346. 'url': 'http://api.dmcloud.net/player/embed/4e7343f894a6f677b10006b4/559545469473996d31429f06?auth=1467430263-0-90tglw2l-a3a4b64ed41efe48d7fccad85b8b8fda&autoplay=1',
  347. 'only_matching': True,
  348. }]
  349. @classmethod
  350. def _extract_dmcloud_url(cls, webpage):
  351. mobj = re.search(r'<iframe[^>]+src=[\'"](%s)[\'"]' % cls._VALID_EMBED_URL, webpage)
  352. if mobj:
  353. return mobj.group(1)
  354. mobj = re.search(
  355. r'<input[^>]+id=[\'"]dmcloudUrlEmissionSelect[\'"][^>]+value=[\'"](%s)[\'"]' % cls._VALID_EMBED_URL,
  356. webpage)
  357. if mobj:
  358. return mobj.group(1)
  359. def _real_extract(self, url):
  360. video_id = self._match_id(url)
  361. webpage = self._download_webpage_no_ff(url, video_id)
  362. title = self._html_search_regex(r'<title>([^>]+)</title>', webpage, 'title')
  363. video_info = self._parse_json(self._search_regex(
  364. r'var\s+info\s*=\s*([^;]+);', webpage, 'video info'), video_id)
  365. # TODO: parse ios_url, which is in fact a manifest
  366. video_url = video_info['mp4_url']
  367. return {
  368. 'id': video_id,
  369. 'url': video_url,
  370. 'title': title,
  371. 'thumbnail': video_info.get('thumbnail_url'),
  372. }