在YQL中使用xpath从网页获取锚文本

时间:2010-05-12 20:58:17

标签: yql

SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()"

不起作用,而

SELECT * FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()"

确实

SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a"

也有效,似乎YQL有错误,或者我错过了什么?

2 个答案:

答案 0 :(得分:0)

这是你在找什么?

SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a"

答案 1 :(得分:0)

SELECT href
FROM html
WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state"
      AND xpath="//a"

在YQL console上尝试。