0
A
回答
1
有人可能會問,但有一半的時間會「回答」與你所要求的不同的東西,其餘的時間會給你一個空的結果。
即使明確的搜索通常會返回空的或意外的結果。例如,當我搜索當前的美國總統時,它返回關於奧巴馬的結果,並且當我搜索美國人口時,它並沒有真正說出應該說什麼(31890(2014)):
=> #<HTTParty::Response:0x7ffc5857b938 parsed_response={"@context"=>{"@vocab"=>"http://schema.org/", "goog"=>"http://schema.googleapis.com/", "EntitySearchResult"=>"goog:EntitySearchResult", "detailedDescription"=>"goog:detailedDescription", "resultScore"=>"goog:resultScore", "kg"=>"http://g.co/kg"}, "@type"=>"ItemList", "itemListElement"=>[{"@type"=>"EntitySearchResult", "result"=>{"@id"=>"kg:/m/09c7w0", "name"=>"United States", "@type"=>["Country", "Thing", "Place", "AdministrativeArea"], "description"=>"Country", "image"=>{"contentUrl"=>"http://t1.gstatic.com/images?q=tbn:ANd9GcQKp8mjZhEK0hZroCA4srP9VA9eD8-0PcCsKSU4olhQlh6dMlxc", "url"=>"https://commons.wikimedia.org/wiki/File:USA_Flag_Map.svg", "license"=>"http://creativecommons.org/licenses/by-sa/2.5"}, "detailedDescription"=>{"articleBody"=>"The United States of America, commonly referred to as the United States or America, is a federal republic composed of 50 states, a federal district, five major self-governing territories, and various possessions. ", "url"=>"https://en.wikipedia.org/wiki/United_States", "license"=>"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"}, "url"=>"http://www.usa.gov/"}, "resultScore"=>246.96698}, {"@type"=>"EntitySearchResult", "result"=>{"@id"=>"kg:/g/1q5jrvck9", "name"=>"Population: Us", "@type"=>["Thing"], "description"=>"Song by Frank Portman"}, "resultScore"=>20.875225}]}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["application/json; charset=UTF-8"], "vary"=>["Origin", "X-Origin", "Referer"], "date"=>["Fri, 03 Feb 2017 20:33:38 GMT"], "server"=>["ESF"], "cache-control"=>["private"], "x-xss-protection"=>["1; mode=block"], "x-frame-options"=>["SAMEORIGIN"], "x-content-type-options"=>["nosniff"], "alt-svc"=>["quic=\":443\"; ma=2592000; v=\"35,34\""], "connection"=>["close"], "transfer-encoding"=>["chunked"]}>
無論我如何使用查詢或使用什麼關鍵字,它實際上都是無用的。我也嘗試指定我想要的結果&types=
。它很少會返回預期的結果;例如,當我搜索美國的:
=> #<HTTParty::Response:0x7ffc58619f20 parsed_response={"@context"=>{"@vocab"=>"http://schema.org/", "goog"=>"http://schema.googleapis.com/", "EntitySearchResult"=>"goog:EntitySearchResult", "detailedDescription"=>"goog:detailedDescription", "resultScore"=>"goog:resultScore", "kg"=>"http://g.co/kg"}, "@type"=>"ItemList", "itemListElement"=>[{"@type"=>"EntitySearchResult", "result"=>{"@id"=>"kg:/m/09c7w0", "name"=>"United States", "@type"=>["Country", "Thing", "Place", "AdministrativeArea"], "description"=>"Country", "image"=>{"contentUrl"=>"http://t1.gstatic.com/images?q=tbn:ANd9GcQKp8mjZhEK0hZroCA4srP9VA9eD8-0PcCsKSU4olhQlh6dMlxc", "url"=>"https://commons.wikimedia.org/wiki/File:USA_Flag_Map.svg", "license"=>"http://creativecommons.org/licenses/by-sa/2.5"}, "detailedDescription"=>{"articleBody"=>"The United States of America, commonly referred to as the United States or America, is a federal republic composed of 50 states, a federal district, five major self-governing territories, and various possessions. ", "url"=>"https://en.wikipedia.org/wiki/United_States", "license"=>"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"}, "url"=>"http://www.usa.gov/"}, "resultScore"=>4238.782227}]}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["application/json; charset=UTF-8"], "vary"=>["Origin", "X-Origin", "Referer"], "date"=>["Fri, 03 Feb 2017 20:29:07 GMT"], "server"=>["ESF"], "cache-control"=>["private"], "x-xss-protection"=>["1; mode=block"], "x-frame-options"=>["SAMEORIGIN"], "x-content-type-options"=>["nosniff"], "alt-svc"=>["quic=\":443\"; ma=2592000; v=\"35,34\""], "connection"=>["close"], "transfer-encoding"=>["chunked"]}>
我建議你不要用它浪費你的時間,我已經做到了。另請注意,Custom Search API不包含知識圖的結果,並且「非自定義」搜索API長期爲deprecated。
相關問題
- 1. 是否有任何PHP API的谷歌+像Facebook圖形API?
- 2. 谷歌條形圖顯示日問題
- 3. 在OSX中使用自由形式的窗口是否可以使用窗口?
- 4. 谷歌是否有我可以用來形成世界數據庫的api?
- 5. 谷歌圖形API自定義工具提示加粗
- 6. 谷歌是否有限制使用Xpath找到ID的形式?
- 7. 谷歌地圖API:確定點是否在內部形狀
- 8. 提交PHP的形式谷歌文檔
- 9. 的jQuery Mobile和谷歌圖形API
- 10. 谷歌地圖API V3的多邊形
- 11. 是否可以使用圖形API創建一個Facebook頁面?
- 12. 是否可以訪問Spotify應用中的歌曲波形?
- 13. Facebook PHP SDK圖形API - 是否可以訪問PAST事件?
- 14. 谷歌地圖API形狀覆蓋的無形地圖
- 15. 檢查多邊形是否自相交谷歌地圖v3
- 16. 使用谷歌圖表api的堆積條形圖
- 17. 是否可以使用BIRT設置自適應圖形?
- 18. 谷歌地圖API V3矩形索引
- 19. getpaths()多邊形谷歌地圖API
- 20. 如何使用谷歌地圖API在谷歌地圖上繪製矩形
- 21. 谷歌形式的陳述
- 22. 谷歌形式的Uploaad圖像按鈕
- 23. 插入谷歌形式的圖片
- 24. 定製提交通知谷歌形式包括在網站
- 25. 在PHP中使用谷歌圖表API實現圖形
- 26. 谷歌圖表樹形圖是否支持角度谷歌圖表?
- 27. 谷歌地圖自定義繪圖Android API v2(弧形折線)
- 28. 谷歌自動完成地址形式
- 29. Facebook圖形API問題
- 30. 谷歌柱形圖使用組
https://developers.google.com/knowledgegraphics上的示例並不多,但在我看來,它是用於按名稱查找實體,而不是用自由文本查找實體。 –