mirror of
				https://gitlab.com/ytdl-org/youtube-dl.git
				synced 2025-11-03 22:57:08 -05:00 
			
		
		
		
	[canalplus] Raise an error if the video is georestricted (closes #4472)
This commit is contained in:
		@@ -5,6 +5,8 @@ import re
 | 
			
		||||
 | 
			
		||||
from .common import InfoExtractor
 | 
			
		||||
from ..utils import (
 | 
			
		||||
    ExtractorError,
 | 
			
		||||
    HEADRequest,
 | 
			
		||||
    unified_strdate,
 | 
			
		||||
    url_basename,
 | 
			
		||||
    qualities,
 | 
			
		||||
@@ -76,6 +78,16 @@ class CanalplusIE(InfoExtractor):
 | 
			
		||||
 | 
			
		||||
        preference = qualities(['MOBILE', 'BAS_DEBIT', 'HAUT_DEBIT', 'HD', 'HLS', 'HDS'])
 | 
			
		||||
 | 
			
		||||
        fmt_url = next(iter(media.find('VIDEOS'))).text
 | 
			
		||||
        if '/geo' in fmt_url.lower():
 | 
			
		||||
            response = self._request_webpage(
 | 
			
		||||
                HEADRequest(fmt_url), video_id,
 | 
			
		||||
                'Checking if the video is georestricted')
 | 
			
		||||
            if '/blocage' in response.geturl():
 | 
			
		||||
                raise ExtractorError(
 | 
			
		||||
                    'The video is not available in your country',
 | 
			
		||||
                    expected=True)
 | 
			
		||||
 | 
			
		||||
        formats = []
 | 
			
		||||
        for fmt in media.find('VIDEOS'):
 | 
			
		||||
            format_url = fmt.text
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user