projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
652f283
)
[utils] Fix find_xpath_attr on 2.6
author
Philipp Hagemeister
<phihag@phihag.de>
Sat, 13 Sep 2014 06:34:15 +0000
(08:34 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Sat, 13 Sep 2014 06:34:15 +0000
(08:34 +0200)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index d920c65a4df4f006ad882a7dc885571182b3aa38..8828161e58fb84401a824656b18fda7be7b71c1f 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-280,6
+280,11
@@
if sys.version_info >= (2, 7):
return node.find(expr)
else:
def find_xpath_attr(node, xpath, key, val):
+ # Here comes the crazy part: In 2.6, if the xpath is a unicode,
+ # .//node does not match if a node is a direct child of . !
+ if isinstance(xpath, unicode):
+ xpath = xpath.encode('ascii')
+
for f in node.findall(xpath):
if f.attrib.get(key) == val:
return f