1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-16 06:34:31 +01:00

[voewster] Detect series geo restriction

This commit is contained in:
Sergey M․ 2015-09-22 21:52:41 +06:00
parent c430802e32
commit cccedc1aa4

View File

@ -3,12 +3,14 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import (
compat_HTTPError,
compat_urllib_request, compat_urllib_request,
compat_urllib_parse, compat_urllib_parse,
compat_urllib_parse_unquote, compat_urllib_parse_unquote,
) )
from ..utils import ( from ..utils import (
determine_ext, determine_ext,
ExtractorError,
int_or_none, int_or_none,
parse_iso8601, parse_iso8601,
HEADRequest, HEADRequest,
@ -86,9 +88,15 @@ class ViewsterIE(InfoExtractor):
# unfinished serie has no Type # unfinished serie has no Type
if info.get('Type') in ['Serie', None]: if info.get('Type') in ['Serie', None]:
try:
episodes = self._download_json( episodes = self._download_json(
'https://public-api.viewster.com/series/%s/episodes' % entry_id, 'https://public-api.viewster.com/series/%s/episodes' % entry_id,
video_id, 'Downloading series JSON') video_id, 'Downloading series JSON')
except ExtractorError as e:
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
self.raise_geo_restricted()
else:
raise
entries = [ entries = [
self.url_result( self.url_result(
'http://www.viewster.com/movie/%s' % episode['OriginId'], 'Viewster') 'http://www.viewster.com/movie/%s' % episode['OriginId'], 'Viewster')