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.

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