2011-07-09 13 views
5

YQL Console LinkYQL HTML要素の属性が失われていますか?

問合せ:バッククエリレベルが1つI、それ完全にストリップ場合

<results> 
     <a href="http://twitter.com/share" data-url="http://www.cbs.com/shows/big_brother/video/2045825951/big-brother-episode-1" class="twitter-share-button"></a> 
    </results> 

select * from html where url='http://www.cbs.com/shows/big_brother/video/' and xpath='//div[@id="cbs-video-metadata-wrapper"]/div[@class="cbs-video-share"]/a' 

戻り値:

<?xml version="1.0" encoding="UTF-8"?> 
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" 
    yahoo:count="1" yahoo:created="2011-07-09T23:14:02Z" yahoo:lang="en-US"> 
    <diagnostics> 
     <publiclyCallable>true</publiclyCallable> 
     <url execution-time="146" proxy="DEFAULT"><![CDATA[http://www.cbs.com/shows/big_brother/video/]]></url> 
     <user-time>163</user-time> 
     <service-time>146</service-time> 
     <build-version>19262</build-version> 
    </diagnostics> 
    <results> 
     <a class="twitter-share-button" href="http://twitter.com/share"/> 
    </results> 
</query> 

はに似たものを返す必要があります私ができる要素私が必要とするデータを取得するために使用してください。

答えて

8

今、カスタム属性を認識する新しいhtmlパーサーがあります。

compat="html5"を追加すると、新しいパーサーがトリガーされます。

例えば:

select * from html where url = "http://mydomain.com" and compat="html5" 
関連する問題