X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ftheplatform.py;h=cec65261bfffd2a25702634047a99526fa3a7d10;hb=bf5b0a1bfb3d875cb3ccd2fc834efd7343885bd2;hp=9206895116e7f1ff66eb9376ba2927adde98431a;hpb=ef2fac6f4ae5191abed1962b155aec0bb0f17802;p=youtube-dl.git diff --git a/youtube_dl/extractor/theplatform.py b/youtube_dl/extractor/theplatform.py index 920689511..cec65261b 100644 --- a/youtube_dl/extractor/theplatform.py +++ b/youtube_dl/extractor/theplatform.py @@ -3,8 +3,8 @@ import json from .common import InfoExtractor from ..utils import ( + ExtractorError, xpath_with_ns, - find_xpath_attr, ) _x = lambda p: xpath_with_ns(p, {'smil': 'http://www.w3.org/2005/SMIL21/Language'}) @@ -33,6 +33,17 @@ class ThePlatformIE(InfoExtractor): smil_url = ('http://link.theplatform.com/s/dJ5BDC/{0}/meta.smil?' 'format=smil&mbr=true'.format(video_id)) meta = self._download_xml(smil_url, video_id) + + try: + error_msg = next( + n.attrib['abstract'] + for n in meta.findall(_x('.//smil:ref')) + if n.attrib.get('title') == u'Geographic Restriction') + except StopIteration: + pass + else: + raise ExtractorError(error_msg, expected=True) + info_url = 'http://link.theplatform.com/s/dJ5BDC/{0}?format=preview'.format(video_id) info_json = self._download_webpage(info_url, video_id) info = json.loads(info_json)