[sky] add support for news.sky.com (closes #13055)
This commit is contained in:
		
							parent
							
								
									f8c55c6664
								
							
						
					
					
						commit
						71ebd35d50
					
				
					 2 changed files with 43 additions and 19 deletions
				
			
		| 
						 | 
					@ -1033,7 +1033,10 @@ from .skynewsarabia import (
 | 
				
			||||||
    SkyNewsArabiaIE,
 | 
					    SkyNewsArabiaIE,
 | 
				
			||||||
    SkyNewsArabiaArticleIE,
 | 
					    SkyNewsArabiaArticleIE,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from .skysports import SkySportsIE
 | 
					from .sky import (
 | 
				
			||||||
 | 
					    SkyNewsIE,
 | 
				
			||||||
 | 
					    SkySportsIE,
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
from .slideshare import SlideshareIE
 | 
					from .slideshare import SlideshareIE
 | 
				
			||||||
from .slideslive import SlidesLiveIE
 | 
					from .slideslive import SlidesLiveIE
 | 
				
			||||||
from .slutload import SlutloadIE
 | 
					from .slutload import SlutloadIE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,34 +10,25 @@ from ..utils import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SkySportsIE(InfoExtractor):
 | 
					class SkyBaseIE(InfoExtractor):
 | 
				
			||||||
    _VALID_URL = r'https?://(?:www\.)?skysports\.com/watch/video/(?P<id>[0-9]+)'
 | 
					 | 
				
			||||||
    _TEST = {
 | 
					 | 
				
			||||||
        'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine',
 | 
					 | 
				
			||||||
        'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec',
 | 
					 | 
				
			||||||
        'info_dict': {
 | 
					 | 
				
			||||||
            'id': '10328419',
 | 
					 | 
				
			||||||
            'ext': 'mp4',
 | 
					 | 
				
			||||||
            'title': 'Bale: It\'s our time to shine',
 | 
					 | 
				
			||||||
            'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d',
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        'add_ie': ['Ooyala'],
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _real_extract(self, url):
 | 
					    def _real_extract(self, url):
 | 
				
			||||||
        video_id = self._match_id(url)
 | 
					        video_id = self._match_id(url)
 | 
				
			||||||
        webpage = self._download_webpage(url, video_id)
 | 
					        webpage = self._download_webpage(url, video_id)
 | 
				
			||||||
        video_data = extract_attributes(self._search_regex(
 | 
					        video_data = extract_attributes(self._search_regex(
 | 
				
			||||||
            r'(<div.+?class="sdc-article-video__media-ooyala"[^>]+>)', webpage, 'video data'))
 | 
					            r'(<div.+?class="[^"]*sdc-article-video__media-ooyala[^"]*"[^>]+>)',
 | 
				
			||||||
 | 
					            webpage, 'video data'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        video_url = 'ooyala:%s' % video_data['data-video-id']
 | 
					        video_url = 'ooyala:%s' % video_data['data-video-id']
 | 
				
			||||||
        if video_data.get('data-token-required') == 'true':
 | 
					        if video_data.get('data-token-required') == 'true':
 | 
				
			||||||
            token_fetch_options = self._parse_json(video_data.get('data-token-fetch-options', '{}'), video_id, fatal=False) or {}
 | 
					            token_fetch_options = self._parse_json(video_data.get(
 | 
				
			||||||
 | 
					                'data-token-fetch-options', '{}'), video_id, fatal=False) or {}
 | 
				
			||||||
            token_fetch_url = token_fetch_options.get('url')
 | 
					            token_fetch_url = token_fetch_options.get('url')
 | 
				
			||||||
            if token_fetch_url:
 | 
					            if token_fetch_url:
 | 
				
			||||||
                embed_token = self._download_webpage(urljoin(url, token_fetch_url), video_id, fatal=False)
 | 
					                embed_token = self._download_webpage(urljoin(
 | 
				
			||||||
 | 
					                    url, token_fetch_url), video_id, fatal=False)
 | 
				
			||||||
                if embed_token:
 | 
					                if embed_token:
 | 
				
			||||||
                    video_url = smuggle_url(video_url, {'embed_token': embed_token.strip('"')})
 | 
					                    video_url = smuggle_url(
 | 
				
			||||||
 | 
					                        video_url, {'embed_token': embed_token.strip('"')})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            '_type': 'url_transparent',
 | 
					            '_type': 'url_transparent',
 | 
				
			||||||
| 
						 | 
					@ -47,3 +38,33 @@ class SkySportsIE(InfoExtractor):
 | 
				
			||||||
            'description': strip_or_none(self._og_search_description(webpage)),
 | 
					            'description': strip_or_none(self._og_search_description(webpage)),
 | 
				
			||||||
            'ie_key': 'Ooyala',
 | 
					            'ie_key': 'Ooyala',
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SkySportsIE(SkyBaseIE):
 | 
				
			||||||
 | 
					    _VALID_URL = r'https?://(?:www\.)?skysports\.com/watch/video/(?P<id>[0-9]+)'
 | 
				
			||||||
 | 
					    _TEST = {
 | 
				
			||||||
 | 
					        'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine',
 | 
				
			||||||
 | 
					        'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec',
 | 
				
			||||||
 | 
					        'info_dict': {
 | 
				
			||||||
 | 
					            'id': 'o3eWJnNDE6l7kfNO8BOoBlRxXRQ4ANNQ',
 | 
				
			||||||
 | 
					            'ext': 'mp4',
 | 
				
			||||||
 | 
					            'title': 'Bale: It\'s our time to shine',
 | 
				
			||||||
 | 
					            'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        'add_ie': ['Ooyala'],
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SkyNewsIE(SkyBaseIE):
 | 
				
			||||||
 | 
					    _VALID_URL = r'https?://news\.sky\.com/video/[0-9a-z-]+-(?P<id>[0-9]+)'
 | 
				
			||||||
 | 
					    _TEST = {
 | 
				
			||||||
 | 
					        'url': 'https://news.sky.com/video/russian-plane-inspected-after-deadly-fire-11712962',
 | 
				
			||||||
 | 
					        'md5': 'd6327e581473cea9976a3236ded370cd',
 | 
				
			||||||
 | 
					        'info_dict': {
 | 
				
			||||||
 | 
					            'id': '1ua21xaDE6lCtZDmbYfl8kwsKLooJbNM',
 | 
				
			||||||
 | 
					            'ext': 'mp4',
 | 
				
			||||||
 | 
					            'title': 'Russian plane inspected after deadly fire',
 | 
				
			||||||
 | 
					            'description': 'The Russian Investigative Committee has released video of the wreckage of a passenger plane which caught fire near Moscow.',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        'add_ie': ['Ooyala'],
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue