diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-11-24 11:02:34 +0100 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-11-24 11:02:34 +0100 |
commit | d214fdb8fe796e92485e28038ee72d28caa3ad10 (patch) | |
tree | e4f0426820ed19201f3bfde24e7a21889b94e715 | |
parent | 138df537ffaeda182789440c4086f009a739dde3 (diff) | |
download | youtube-dl-d214fdb8fe796e92485e28038ee72d28caa3ad10.zip youtube-dl-d214fdb8fe796e92485e28038ee72d28caa3ad10.tar.gz youtube-dl-d214fdb8fe796e92485e28038ee72d28caa3ad10.tar.bz2 |
[brightcove] Don't use 'or' with the xml nodes, use the 'value' attribute instead
-rw-r--r-- | youtube_dl/extractor/brightcove.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index 74a7d13..66fe0ac 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -76,18 +76,21 @@ class BrightcoveIE(InfoExtractor): 'playerID': find_xpath_attr(object_doc, './param', 'name', 'playerID').attrib['value'], } def find_param(name): - return find_xpath_attr(object_doc, './param', 'name', name) + node = find_xpath_attr(object_doc, './param', 'name', name) + if node is not None: + return node.attrib['value'] + return None playerKey = find_param('playerKey') # Not all pages define this value if playerKey is not None: - params['playerKey'] = playerKey.attrib['value'] + params['playerKey'] = playerKey # The three fields hold the id of the video videoPlayer = find_param('@videoPlayer') or find_param('videoId') or find_param('videoID') if videoPlayer is not None: - params['@videoPlayer'] = videoPlayer.attrib['value'] + params['@videoPlayer'] = videoPlayer linkBase = find_param('linkBaseURL') if linkBase is not None: - params['linkBaseURL'] = linkBase.attrib['value'] + params['linkBaseURL'] = linkBase data = compat_urllib_parse.urlencode(params) return cls._FEDERATED_URL_TEMPLATE % data |