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.

474 lines
18 KiB

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
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
10 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..compat import (
  6. compat_str,
  7. compat_xpath,
  8. )
  9. from ..utils import (
  10. ExtractorError,
  11. find_xpath_attr,
  12. fix_xml_ampersands,
  13. float_or_none,
  14. HEADRequest,
  15. RegexNotFoundError,
  16. sanitized_Request,
  17. strip_or_none,
  18. timeconvert,
  19. try_get,
  20. unescapeHTML,
  21. update_url_query,
  22. url_basename,
  23. xpath_text,
  24. )
  25. def _media_xml_tag(tag):
  26. return '{http://search.yahoo.com/mrss/}%s' % tag
  27. class MTVServicesInfoExtractor(InfoExtractor):
  28. _MOBILE_TEMPLATE = None
  29. _LANG = None
  30. @staticmethod
  31. def _id_from_uri(uri):
  32. return uri.split(':')[-1]
  33. @staticmethod
  34. def _remove_template_parameter(url):
  35. # Remove the templates, like &device={device}
  36. return re.sub(r'&[^=]*?={.*?}(?=(&|$))', '', url)
  37. def _get_feed_url(self, uri):
  38. return self._FEED_URL
  39. def _get_thumbnail_url(self, uri, itemdoc):
  40. search_path = '%s/%s' % (_media_xml_tag('group'), _media_xml_tag('thumbnail'))
  41. thumb_node = itemdoc.find(search_path)
  42. if thumb_node is None:
  43. return None
  44. return thumb_node.get('url') or thumb_node.text or None
  45. def _extract_mobile_video_formats(self, mtvn_id):
  46. webpage_url = self._MOBILE_TEMPLATE % mtvn_id
  47. req = sanitized_Request(webpage_url)
  48. # Otherwise we get a webpage that would execute some javascript
  49. req.add_header('User-Agent', 'curl/7')
  50. webpage = self._download_webpage(req, mtvn_id,
  51. 'Downloading mobile page')
  52. metrics_url = unescapeHTML(self._search_regex(r'<a href="(http://metrics.+?)"', webpage, 'url'))
  53. req = HEADRequest(metrics_url)
  54. response = self._request_webpage(req, mtvn_id, 'Resolving url')
  55. url = response.geturl()
  56. # Transform the url to get the best quality:
  57. url = re.sub(r'.+pxE=mp4', 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=0+_pxK=18639+_pxE=mp4', url, 1)
  58. return [{'url': url, 'ext': 'mp4'}]
  59. def _extract_video_formats(self, mdoc, mtvn_id, video_id):
  60. if re.match(r'.*/(error_country_block\.swf|geoblock\.mp4|copyright_error\.flv(?:\?geo\b.+?)?)$', mdoc.find('.//src').text) is not None:
  61. if mtvn_id is not None and self._MOBILE_TEMPLATE is not None:
  62. self.to_screen('The normal version is not available from your '
  63. 'country, trying with the mobile version')
  64. return self._extract_mobile_video_formats(mtvn_id)
  65. raise ExtractorError('This video is not available from your country.',
  66. expected=True)
  67. formats = []
  68. for rendition in mdoc.findall('.//rendition'):
  69. if rendition.get('method') == 'hls':
  70. hls_url = rendition.find('./src').text
  71. formats.extend(self._extract_m3u8_formats(
  72. hls_url, video_id, ext='mp4', entry_protocol='m3u8_native',
  73. m3u8_id='hls', fatal=False))
  74. else:
  75. # fms
  76. try:
  77. _, _, ext = rendition.attrib['type'].partition('/')
  78. rtmp_video_url = rendition.find('./src').text
  79. if 'error_not_available.swf' in rtmp_video_url:
  80. raise ExtractorError(
  81. '%s said: video is not available' % self.IE_NAME,
  82. expected=True)
  83. if rtmp_video_url.endswith('siteunavail.png'):
  84. continue
  85. formats.extend([{
  86. 'ext': 'flv' if rtmp_video_url.startswith('rtmp') else ext,
  87. 'url': rtmp_video_url,
  88. 'format_id': '-'.join(filter(None, [
  89. 'rtmp' if rtmp_video_url.startswith('rtmp') else None,
  90. rendition.get('bitrate')])),
  91. 'width': int(rendition.get('width')),
  92. 'height': int(rendition.get('height')),
  93. }])
  94. except (KeyError, TypeError):
  95. raise ExtractorError('Invalid rendition field.')
  96. if formats:
  97. self._sort_formats(formats)
  98. return formats
  99. def _extract_subtitles(self, mdoc, mtvn_id):
  100. subtitles = {}
  101. for transcript in mdoc.findall('.//transcript'):
  102. if transcript.get('kind') != 'captions':
  103. continue
  104. lang = transcript.get('srclang')
  105. for typographic in transcript.findall('./typographic'):
  106. sub_src = typographic.get('src')
  107. if not sub_src:
  108. continue
  109. ext = typographic.get('format')
  110. if ext == 'cea-608':
  111. ext = 'scc'
  112. subtitles.setdefault(lang, []).append({
  113. 'url': compat_str(sub_src),
  114. 'ext': ext
  115. })
  116. return subtitles
  117. def _get_video_info(self, itemdoc, use_hls=True):
  118. uri = itemdoc.find('guid').text
  119. video_id = self._id_from_uri(uri)
  120. self.report_extraction(video_id)
  121. content_el = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content')))
  122. mediagen_url = self._remove_template_parameter(content_el.attrib['url'])
  123. mediagen_url = mediagen_url.replace('device={device}', '')
  124. if 'acceptMethods' not in mediagen_url:
  125. mediagen_url += '&' if '?' in mediagen_url else '?'
  126. mediagen_url += 'acceptMethods='
  127. mediagen_url += 'hls' if use_hls else 'fms'
  128. mediagen_doc = self._download_xml(
  129. mediagen_url, video_id, 'Downloading video urls', fatal=False)
  130. if mediagen_doc is False:
  131. return None
  132. item = mediagen_doc.find('./video/item')
  133. if item is not None and item.get('type') == 'text':
  134. message = '%s returned error: ' % self.IE_NAME
  135. if item.get('code') is not None:
  136. message += '%s - ' % item.get('code')
  137. message += item.text
  138. raise ExtractorError(message, expected=True)
  139. description = strip_or_none(xpath_text(itemdoc, 'description'))
  140. timestamp = timeconvert(xpath_text(itemdoc, 'pubDate'))
  141. title_el = None
  142. if title_el is None:
  143. title_el = find_xpath_attr(
  144. itemdoc, './/{http://search.yahoo.com/mrss/}category',
  145. 'scheme', 'urn:mtvn:video_title')
  146. if title_el is None:
  147. title_el = itemdoc.find(compat_xpath('.//{http://search.yahoo.com/mrss/}title'))
  148. if title_el is None:
  149. title_el = itemdoc.find(compat_xpath('.//title'))
  150. if title_el.text is None:
  151. title_el = None
  152. title = title_el.text
  153. if title is None:
  154. raise ExtractorError('Could not find video title')
  155. title = title.strip()
  156. # This a short id that's used in the webpage urls
  157. mtvn_id = None
  158. mtvn_id_node = find_xpath_attr(itemdoc, './/{http://search.yahoo.com/mrss/}category',
  159. 'scheme', 'urn:mtvn:id')
  160. if mtvn_id_node is not None:
  161. mtvn_id = mtvn_id_node.text
  162. formats = self._extract_video_formats(mediagen_doc, mtvn_id, video_id)
  163. # Some parts of complete video may be missing (e.g. missing Act 3 in
  164. # http://www.southpark.de/alle-episoden/s14e01-sexual-healing)
  165. if not formats:
  166. return None
  167. self._sort_formats(formats)
  168. return {
  169. 'title': title,
  170. 'formats': formats,
  171. 'subtitles': self._extract_subtitles(mediagen_doc, mtvn_id),
  172. 'id': video_id,
  173. 'thumbnail': self._get_thumbnail_url(uri, itemdoc),
  174. 'description': description,
  175. 'duration': float_or_none(content_el.attrib.get('duration')),
  176. 'timestamp': timestamp,
  177. }
  178. def _get_feed_query(self, uri):
  179. data = {'uri': uri}
  180. if self._LANG:
  181. data['lang'] = self._LANG
  182. return data
  183. def _get_videos_info(self, uri, use_hls=True):
  184. video_id = self._id_from_uri(uri)
  185. feed_url = self._get_feed_url(uri)
  186. info_url = update_url_query(feed_url, self._get_feed_query(uri))
  187. return self._get_videos_info_from_url(info_url, video_id, use_hls)
  188. def _get_videos_info_from_url(self, url, video_id, use_hls=True):
  189. idoc = self._download_xml(
  190. url, video_id,
  191. 'Downloading info', transform_source=fix_xml_ampersands)
  192. title = xpath_text(idoc, './channel/title')
  193. description = xpath_text(idoc, './channel/description')
  194. entries = []
  195. for item in idoc.findall('.//item'):
  196. info = self._get_video_info(item, use_hls)
  197. if info:
  198. entries.append(info)
  199. return self.playlist_result(
  200. entries, playlist_title=title, playlist_description=description)
  201. def _extract_triforce_mgid(self, webpage, data_zone=None, video_id=None):
  202. triforce_feed = self._parse_json(self._search_regex(
  203. r'triforceManifestFeed\s*=\s*({.+?})\s*;\s*\n', webpage,
  204. 'triforce feed', default='{}'), video_id, fatal=False)
  205. data_zone = self._search_regex(
  206. r'data-zone=(["\'])(?P<zone>.+?_lc_promo.*?)\1', webpage,
  207. 'data zone', default=data_zone, group='zone')
  208. feed_url = try_get(
  209. triforce_feed, lambda x: x['manifest']['zones'][data_zone]['feed'],
  210. compat_str)
  211. if not feed_url:
  212. return
  213. feed = self._download_json(feed_url, video_id, fatal=False)
  214. if not feed:
  215. return
  216. return try_get(feed, lambda x: x['result']['data']['id'], compat_str)
  217. def _extract_mgid(self, webpage):
  218. try:
  219. # the url can be http://media.mtvnservices.com/fb/{mgid}.swf
  220. # or http://media.mtvnservices.com/{mgid}
  221. og_url = self._og_search_video_url(webpage)
  222. mgid = url_basename(og_url)
  223. if mgid.endswith('.swf'):
  224. mgid = mgid[:-4]
  225. except RegexNotFoundError:
  226. mgid = None
  227. if mgid is None or ':' not in mgid:
  228. mgid = self._search_regex(
  229. [r'data-mgid="(.*?)"', r'swfobject\.embedSWF\(".*?(mgid:.*?)"'],
  230. webpage, 'mgid', default=None)
  231. if not mgid:
  232. sm4_embed = self._html_search_meta(
  233. 'sm4:video:embed', webpage, 'sm4 embed', default='')
  234. mgid = self._search_regex(
  235. r'embed/(mgid:.+?)["\'&?/]', sm4_embed, 'mgid', default=None)
  236. if not mgid:
  237. mgid = self._extract_triforce_mgid(webpage)
  238. return mgid
  239. def _real_extract(self, url):
  240. title = url_basename(url)
  241. webpage = self._download_webpage(url, title)
  242. mgid = self._extract_mgid(webpage)
  243. videos_info = self._get_videos_info(mgid)
  244. return videos_info
  245. class MTVServicesEmbeddedIE(MTVServicesInfoExtractor):
  246. IE_NAME = 'mtvservices:embedded'
  247. _VALID_URL = r'https?://media\.mtvnservices\.com/embed/(?P<mgid>.+?)(\?|/|$)'
  248. _TEST = {
  249. # From http://www.thewrap.com/peter-dinklage-sums-up-game-of-thrones-in-45-seconds-video/
  250. 'url': 'http://media.mtvnservices.com/embed/mgid:uma:video:mtv.com:1043906/cp~vid%3D1043906%26uri%3Dmgid%3Auma%3Avideo%3Amtv.com%3A1043906',
  251. 'md5': 'cb349b21a7897164cede95bd7bf3fbb9',
  252. 'info_dict': {
  253. 'id': '1043906',
  254. 'ext': 'mp4',
  255. 'title': 'Peter Dinklage Sums Up \'Game Of Thrones\' In 45 Seconds',
  256. 'description': '"Sexy sexy sexy, stabby stabby stabby, beautiful language," says Peter Dinklage as he tries summarizing "Game of Thrones" in under a minute.',
  257. 'timestamp': 1400126400,
  258. 'upload_date': '20140515',
  259. },
  260. }
  261. @staticmethod
  262. def _extract_url(webpage):
  263. mobj = re.search(
  264. r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//media.mtvnservices.com/embed/.+?)\1', webpage)
  265. if mobj:
  266. return mobj.group('url')
  267. def _get_feed_url(self, uri):
  268. video_id = self._id_from_uri(uri)
  269. config = self._download_json(
  270. 'http://media.mtvnservices.com/pmt/e1/access/index.html?uri=%s&configtype=edge' % uri, video_id)
  271. return self._remove_template_parameter(config['feedWithQueryParams'])
  272. def _real_extract(self, url):
  273. mobj = re.match(self._VALID_URL, url)
  274. mgid = mobj.group('mgid')
  275. return self._get_videos_info(mgid)
  276. class MTVIE(MTVServicesInfoExtractor):
  277. IE_NAME = 'mtv'
  278. _VALID_URL = r'https?://(?:www\.)?mtv\.com/(?:video-clips|(?:full-)?episodes)/(?P<id>[^/?#.]+)'
  279. _FEED_URL = 'http://www.mtv.com/feeds/mrss/'
  280. _TESTS = [{
  281. 'url': 'http://www.mtv.com/video-clips/vl8qof/unlocking-the-truth-trailer',
  282. 'md5': '1edbcdf1e7628e414a8c5dcebca3d32b',
  283. 'info_dict': {
  284. 'id': '5e14040d-18a4-47c4-a582-43ff602de88e',
  285. 'ext': 'mp4',
  286. 'title': 'Unlocking The Truth|July 18, 2016|1|101|Trailer',
  287. 'description': '"Unlocking the Truth" premieres August 17th at 11/10c.',
  288. 'timestamp': 1468846800,
  289. 'upload_date': '20160718',
  290. },
  291. }, {
  292. 'url': 'http://www.mtv.com/full-episodes/94tujl/unlocking-the-truth-gates-of-hell-season-1-ep-101',
  293. 'only_matching': True,
  294. }, {
  295. 'url': 'http://www.mtv.com/episodes/g8xu7q/teen-mom-2-breaking-the-wall-season-7-ep-713',
  296. 'only_matching': True,
  297. }]
  298. class MTVJapanIE(MTVServicesInfoExtractor):
  299. IE_NAME = 'mtvjapan'
  300. _VALID_URL = r'https?://(?:www\.)?mtvjapan\.com/videos/(?P<id>[0-9a-z]+)'
  301. _TEST = {
  302. 'url': 'http://www.mtvjapan.com/videos/prayht/fresh-info-cadillac-escalade',
  303. 'info_dict': {
  304. 'id': 'bc01da03-6fe5-4284-8880-f291f4e368f5',
  305. 'ext': 'mp4',
  306. 'title': '【Fresh Info】Cadillac ESCALADE Sport Edition',
  307. },
  308. 'params': {
  309. 'skip_download': True,
  310. },
  311. }
  312. _GEO_COUNTRIES = ['JP']
  313. _FEED_URL = 'http://feeds.mtvnservices.com/od/feed/intl-mrss-player-feed'
  314. def _get_feed_query(self, uri):
  315. return {
  316. 'arcEp': 'mtvjapan.com',
  317. 'mgid': uri,
  318. }
  319. class MTVVideoIE(MTVServicesInfoExtractor):
  320. IE_NAME = 'mtv:video'
  321. _VALID_URL = r'''(?x)^https?://
  322. (?:(?:www\.)?mtv\.com/videos/.+?/(?P<videoid>[0-9]+)/[^/]+$|
  323. m\.mtv\.com/videos/video\.rbml\?.*?id=(?P<mgid>[^&]+))'''
  324. _FEED_URL = 'http://www.mtv.com/player/embed/AS3/rss/'
  325. _TESTS = [
  326. {
  327. 'url': 'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml',
  328. 'md5': '850f3f143316b1e71fa56a4edfd6e0f8',
  329. 'info_dict': {
  330. 'id': '853555',
  331. 'ext': 'mp4',
  332. 'title': 'Taylor Swift - "Ours (VH1 Storytellers)"',
  333. 'description': 'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.',
  334. 'timestamp': 1352610000,
  335. 'upload_date': '20121111',
  336. },
  337. },
  338. ]
  339. def _get_thumbnail_url(self, uri, itemdoc):
  340. return 'http://mtv.mtvnimages.com/uri/' + uri
  341. def _real_extract(self, url):
  342. mobj = re.match(self._VALID_URL, url)
  343. video_id = mobj.group('videoid')
  344. uri = mobj.groupdict().get('mgid')
  345. if uri is None:
  346. webpage = self._download_webpage(url, video_id)
  347. # Some videos come from Vevo.com
  348. m_vevo = re.search(
  349. r'(?s)isVevoVideo = true;.*?vevoVideoId = "(.*?)";', webpage)
  350. if m_vevo:
  351. vevo_id = m_vevo.group(1)
  352. self.to_screen('Vevo video detected: %s' % vevo_id)
  353. return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
  354. uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, 'uri')
  355. return self._get_videos_info(uri)
  356. class MTVDEIE(MTVServicesInfoExtractor):
  357. IE_NAME = 'mtv.de'
  358. _VALID_URL = r'https?://(?:www\.)?mtv\.de/(?:musik/videoclips|folgen|news)/(?P<id>[0-9a-z]+)'
  359. _TESTS = [{
  360. 'url': 'http://www.mtv.de/musik/videoclips/2gpnv7/Traum',
  361. 'info_dict': {
  362. 'id': 'd5d472bc-f5b7-11e5-bffd-a4badb20dab5',
  363. 'ext': 'mp4',
  364. 'title': 'Traum',
  365. 'description': 'Traum',
  366. },
  367. 'params': {
  368. # rtmp download
  369. 'skip_download': True,
  370. },
  371. 'skip': 'Blocked at Travis CI',
  372. }, {
  373. # mediagen URL without query (e.g. http://videos.mtvnn.com/mediagen/e865da714c166d18d6f80893195fcb97)
  374. 'url': 'http://www.mtv.de/folgen/6b1ylu/teen-mom-2-enthuellungen-S5-F1',
  375. 'info_dict': {
  376. 'id': '1e5a878b-31c5-11e7-a442-0e40cf2fc285',
  377. 'ext': 'mp4',
  378. 'title': 'Teen Mom 2',
  379. 'description': 'md5:dc65e357ef7e1085ed53e9e9d83146a7',
  380. },
  381. 'params': {
  382. # rtmp download
  383. 'skip_download': True,
  384. },
  385. 'skip': 'Blocked at Travis CI',
  386. }, {
  387. 'url': 'http://www.mtv.de/news/glolix/77491-mtv-movies-spotlight--pixels--teil-3',
  388. 'info_dict': {
  389. 'id': 'local_playlist-4e760566473c4c8c5344',
  390. 'ext': 'mp4',
  391. 'title': 'Article_mtv-movies-spotlight-pixels-teil-3_short-clips_part1',
  392. 'description': 'MTV Movies Supercut',
  393. },
  394. 'params': {
  395. # rtmp download
  396. 'skip_download': True,
  397. },
  398. 'skip': 'Das Video kann zur Zeit nicht abgespielt werden.',
  399. }]
  400. _GEO_COUNTRIES = ['DE']
  401. _FEED_URL = 'http://feeds.mtvnservices.com/od/feed/intl-mrss-player-feed'
  402. def _get_feed_query(self, uri):
  403. return {
  404. 'arcEp': 'mtv.de',
  405. 'mgid': uri,
  406. }