Getting anchor text from a webpage using xpath within YQL
SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()"
does not work, whereas
开发者_高级运维SELECT * FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()"
does.
SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a"
also works, it seems YQL has a bug, or am I missing something?
Is this what you are looking for?
SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a"
SELECT href
FROM html
WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state"
AND xpath="//a"
Try it on the YQL console.
精彩评论