summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <[email protected]>2013-12-09 20:01:43 +0100
committerJaime Marquínez Ferrándiz <[email protected]>2013-12-09 20:01:43 +0100
commit77526143e789368a15a0e89bfed5dbc52f8db9e5 (patch)
treebc748edd41d413a400becd0e3df424f17b83e834 /youtube_dl
parent4ff50ef84607ee60ff813f7d7f3d35c8b497bf07 (diff)
downloadyoutube-dl-77526143e789368a15a0e89bfed5dbc52f8db9e5.tar.gz
youtube-dl-77526143e789368a15a0e89bfed5dbc52f8db9e5.zip
[brightcove] Use the original url (usually the player) as the default referer (fixes #1929)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/brightcove.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py
index 66fe0ac9a..63577a3cb 100644
--- a/youtube_dl/extractor/brightcove.py
+++ b/youtube_dl/extractor/brightcove.py
@@ -55,6 +55,18 @@ class BrightcoveIE(InfoExtractor):
u'uploader': u'Mashable',
},
},
+ {
+ # test that the default referer works
+ # from http://national.ballet.ca/interact/video/Lost_in_Motion_II/
+ u'url': u'http://link.brightcove.com/services/player/bcpid756015033001?bckey=AQ~~,AAAApYJi_Ck~,GxhXCegT1Dp39ilhXuxMJxasUhVNZiil&bctid=2878862109001',
+ u'info_dict': {
+ u'id': u'2878862109001',
+ u'ext': u'mp4',
+ u'title': u'Lost in Motion II',
+ u'description': u'md5:363109c02998fee92ec02211bd8000df',
+ u'uploader': u'National Ballet of Canada',
+ },
+ },
]
@classmethod
@@ -118,17 +130,21 @@ class BrightcoveIE(InfoExtractor):
videoPlayer = query.get('@videoPlayer')
if videoPlayer:
- return self._get_video_info(videoPlayer[0], query_str, query)
+ return self._get_video_info(videoPlayer[0], query_str, query,
+ # We set the original url as the default 'Referer' header
+ referer=url)
else:
player_key = query['playerKey']
return self._get_playlist_info(player_key[0])
- def _get_video_info(self, video_id, query_str, query):
+ def _get_video_info(self, video_id, query_str, query, referer=None):
request_url = self._FEDERATED_URL_TEMPLATE % query_str
req = compat_urllib_request.Request(request_url)
linkBase = query.get('linkBaseURL')
if linkBase is not None:
- req.add_header('Referer', linkBase[0])
+ referer = linkBase[0]
+ if referer is not None:
+ req.add_header('Referer', referer)
webpage = self._download_webpage(req, video_id)
self.report_extraction(video_id)