I am trying to parse Youtube Gdata to see if video with given id exists. But there isn't normal tag but with namespace. On the link http://gdata.youtube.com/feeds/api/videos?q=KgfdlZuVz7I there is tag:
<openSearch:totalResults>1</openSearch:totalResults>
There is namespace openSearch:
xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
but I dont know how to deal with it in Nokogiri and Ruby.
Here is part of code:
xmlfeed = Nokogiri::HTML(open("http://gdata.youtube.com/feeds/api/videos?q=#{video_id}"))
xmlfeed.at_xpath("openSearch:totalResults")
It gives error:
Undefined namespace prefix: openSearch:totalResults
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…