mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 09:07:58 +01:00
[canalplus] Raise an error if the video is georestricted (closes #4472)
This commit is contained in:
parent
62420c73cb
commit
817f786fbb
1 changed files with 12 additions and 0 deletions
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
HEADRequest,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
url_basename,
|
url_basename,
|
||||||
qualities,
|
qualities,
|
||||||
|
@ -76,6 +78,16 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
preference = qualities(['MOBILE', 'BAS_DEBIT', 'HAUT_DEBIT', 'HD', 'HLS', 'HDS'])
|
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 = []
|
formats = []
|
||||||
for fmt in media.find('VIDEOS'):
|
for fmt in media.find('VIDEOS'):
|
||||||
format_url = fmt.text
|
format_url = fmt.text
|
||||||
|
|
Loading…
Reference in a new issue