diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-07-12 14:53:28 +0200 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-07-12 14:53:28 +0200 |
commit | 6543f0dca5e04530450fac5a64efa5d9ee294b1b (patch) | |
tree | 76680eefd70e8dda9a0202e9c4c49f698a98d3dc /youtube_dl/extractor/brightcove.py | |
parent | 232eb88bfefa0bc6d9ba8df608de62704dbf217c (diff) |
BrightcoveIE: Use parse_qs to extract the fields of the query (closes #1032)
Add a compat_urlparse to utils.
Diffstat (limited to 'youtube_dl/extractor/brightcove.py')
-rw-r--r-- | youtube_dl/extractor/brightcove.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index 450b4a406..71e3c7883 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -6,6 +6,7 @@ from .common import InfoExtractor from ..utils import ( compat_urllib_parse, find_xpath_attr, + compat_urlparse, ) class BrightcoveIE(InfoExtractor): @@ -39,15 +40,15 @@ class BrightcoveIE(InfoExtractor): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - query = mobj.group('query') + query_str = mobj.group('query') + query = compat_urlparse.parse_qs(query_str) - m_video_id = re.search(r'videoPlayer=(\d+)', query) - if m_video_id is not None: - video_id = m_video_id.group(1) - return self._get_video_info(video_id, query) + videoPlayer = query.get('@videoPlayer') + if videoPlayer: + return self._get_video_info(videoPlayer[0], query_str) else: - player_key = self._search_regex(r'playerKey=(.+?)(&|$)', query, 'playlist_id') - return self._get_playlist_info(player_key) + player_key = query['playerKey'] + return self._get_playlist_info(player_key[0]) def _get_video_info(self, video_id, query): request_url = self._FEDERATED_URL_TEMPLATE % query |