mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:06:49 +00:00
[XFileShare] Add geo-block detection
This commit is contained in:
parent
94f181f9f5
commit
ae0cbb84f2
@ -13,6 +13,7 @@ from ..utils import (
|
|||||||
decode_packed_codes,
|
decode_packed_codes,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
get_element_by_class,
|
||||||
get_element_by_id,
|
get_element_by_id,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
@ -200,11 +201,20 @@ class XFileShareIE(InfoExtractor):
|
|||||||
host,
|
host,
|
||||||
'embed-%s.html' % video_id if host in ('govid.me', 'vidlo.us') else video_id)
|
'embed-%s.html' % video_id if host in ('govid.me', 'vidlo.us') else video_id)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
container_div = get_element_by_id('container', webpage) or webpage
|
main = self._search_regex(
|
||||||
|
r'(?s)<main>(.+)</main>', webpage, 'main', default=webpage)
|
||||||
|
container_div = (
|
||||||
|
get_element_by_id('container', main)
|
||||||
|
or get_element_by_class('container', main)
|
||||||
|
or webpage)
|
||||||
if self._search_regex(
|
if self._search_regex(
|
||||||
r'>This server is in maintenance mode\.', container_div,
|
r'>This server is in maintenance mode\.', container_div,
|
||||||
'maint error', group=0, default=None):
|
'maint error', group=0, default=None):
|
||||||
raise ExtractorError(clean_html(container_div), expected=True)
|
raise ExtractorError(clean_html(container_div), expected=True)
|
||||||
|
if self._search_regex(
|
||||||
|
'not available in your country', container_div,
|
||||||
|
'geo block', group=0, default=None):
|
||||||
|
self.raise_geo_restricted()
|
||||||
if self._search_regex(
|
if self._search_regex(
|
||||||
self._FILE_NOT_FOUND_REGEXES, container_div,
|
self._FILE_NOT_FOUND_REGEXES, container_div,
|
||||||
'missing video error', group=0, default=None):
|
'missing video error', group=0, default=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user