projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5fe18bd
)
[theplatform] Detect geoblocked content
author
Philipp Hagemeister
<phihag@phihag.de>
Mon, 16 Dec 2013 02:34:46 +0000
(
03:34
+0100)
committer
Philipp Hagemeister
<phihag@phihag.de>
Mon, 16 Dec 2013 02:34:46 +0000
(
03:34
+0100)
youtube_dl/extractor/theplatform.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/theplatform.py
b/youtube_dl/extractor/theplatform.py
index 61452e47d760cc76731f8e9bfbc319377cf84a25..650d7517f83ee09d4467d4338cbd7c97620121a5 100644
(file)
--- a/
youtube_dl/extractor/theplatform.py
+++ b/
youtube_dl/extractor/theplatform.py
@@
-3,6
+3,7
@@
import json
from .common import InfoExtractor
from ..utils import (
from .common import InfoExtractor
from ..utils import (
+ ExtractorError,
xpath_with_ns,
)
xpath_with_ns,
)
@@
-32,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)
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['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)
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)