顯示具有 YQL 標籤的文章。 顯示所有文章
顯示具有 YQL 標籤的文章。 顯示所有文章

2017年6月9日 星期五

【API分享】利用 API YAHOO YQL GOOGLE API YQL 爬資料 2017-06-08

YQL select from html ( html table is no longer supported )

2017-06-08

說明:已不提供支援

可以改抓 select from htmlpost  (you use htmlpost )
使用post ,但結果(RESULT) 會多一層   postresult

自己在 call function 在調整

change use htmlpost 


官網:https://developer.yahoo.com/yql/console/?q=select%20*%20from%20csv%20where%20url%3D%27http%3A%2F%2Fsamplecsvs.s3.amazonaws.com%2FSacramentorealestatetransactions.csv%27%0A%20%20%20%20%20%20and%20columns%3D%27street%2Ccity%2Czip%2Cstate%2Cbeds%2Cbaths%2Csq__ft%2Ctype%2Csale_date%2Cprice%2Clatitude%2Clongitude%27&env=store://datatables.org/alltableswithkeys#




【YQL API - From 來源】
股票
yahoo.finance.quotes
天氣
weather.forecast

任何網址
url
說明:https://developer.yahoo.com/weather/
說明:http://www.jianshu.com/p/7ce4b21810e5?nomobile=yes

歷史查詢
yahoo.finance.historicaldata
說明:http://www.itkeyword.com/doc/7472183801132171674/how-to-access-yahoo-finance-yql-query-with-historical-data

新聞
search.news
說明:http://www.jianshu.com/p/b947ecf6cd05
------------------------------------------------------


https://query.yahooapis.com/v1/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDHKD%22%2C%20%22USDJPY%22%2C%20%22USDTWD%22)&format=json&diagnostics=true&callback=

XML 美金、香港、日本、台幣
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("HKDTWD", "JPYTWD", "USDTWD")&format=json&env=store://datatables.org/alltableswithkeys
JSON 美金、香港、日本、台幣
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("HKDTWD", "JPYTWD", "USDTWD")&format=json&env=store://datatables.org/alltableswithkeys

查詢港股
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ("2002.HK")&format=json&env=store://datatables.org/alltableswithkeys

查詢台股
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ("2002.HK")&format=json&env=store://datatables.org/alltableswithkeys

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22HKDTWD%22,%20%22JPYTWD%22,%20%22USDTWD%22)&format=json&env=store://datatables.org/alltableswithkeys

Google API JSON 匯率
來源網址 http://sya.idv.tw/archives/1131
https://www.google.com/finance/info?q=CURRENCY:TWDJPY,TWDUSD
https://www.google.com/finance/info?q=CURRENCY:TWDUSD
https://www.google.com/finance/info?q=CURRENCY:USDTWD

要顯示多筆可以逗號分開
//取2002即時股價 JSON
http://finance.google.com/finance/info?client=ig&q=TAIEX:2002
http://finance.google.com/finance/info?client=ig&q=TAIEX:2002,1101

//香港 2002 股價 JSON
http://finance.google.com/finance/info?client=ig&q=HKG:2002

//美國 蘋果股 JSON
http://finance.google.com/finance/info?client=ig&q=AAPL,YHOO

來源網址:
http://lovecoding.logdown.com/posts/257928-use-yahoo-api-to-obtain-historical-stock-price-data

http://blog.asper.tw/2015/05/json.html
http://asper-bot-rates.appspot.com/currency.json

https://tw.rter.info/capi.php


https://www.google.com/finance/getprices?q=2002&x=TPE&i=86400&p=3d&f=d,c,h,l,o,v

yahoo api CSV 檔案
http://download.finance.yahoo.com/d/quotes.csv?s=AUDUSD=X&f=nl1d1t1
http://download.finance.yahoo.com/d/quotes.csv?s=USDTWD=x,TWDJPY=x&f=nl1d1t1

UI
https://finance.yahoo.com/quote/2002.TW/history?ltr=1

http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

UI
https://www.google.com/finance/converter?a=1&from=TWD&to=JPY

UI
https://www.google.com/finance?q=JPYUSD

來源網址:http://myskilltree.blogspot.tw/2016/03/yahoo-api.html
http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote?format=json

XML
https://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote
https://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote?format=json

//yahoo API 說明
http://wiki.dreamrunner.org/public_html/Misc/Trade/FinanceAPI.html
http://wern-ancheta.com/blog/2015/04/05/getting-started-with-the-yahoo-finance-api/


https://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Fyqlblog.net%2Fsamples%2Fhelloworld.xml%22%3Bselect%20*%20from%20helloworld%20where%20a%3D%22cat%22%20and%20b%3D%22dog%22%3B%0A&diagnostics=true

https://blog.ccjeng.com/2016/03/Yahoo-Finance-API.html

來源網址:
https://sya.idv.tw/archives/1131


https://query.yahooapis.com/v1/public/yql?q=select * from html where url='http://en.wikipedia.org/wiki/Yahoo' and xpath='//table/*[contains(.,"Founder")]//a'
select * from html where url='http://en.wikipedia.org/wiki/Yahoo' and xpath='//table/*[contains(.,"Founder")]//a'


https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ('2628.HK')&format=json&diagnostics=true



function getData() {
    var url = 'http://query.yahooapis.com/v1/public/yql';
    var symbol = $("#symbol").val();
    var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('" + symbol + "')");

    $.getJSON(url, 'q=' + data + "&format=json&diagnostics=true&env=http://datatables.org/alltables.env")
        .done(function (data) {
            $('#result').text("Price: " + data.query.results.quote.LastTradePriceOnly);
        })
        .fail(function (jqxhr, textStatus, error) {
            var err = textStatus + ", " + error;
            console.log('Request failed: ' + err);
        });
}

http://www.itkeyword.com/doc/3970460632658567818/localhost-jsonp-ajax

【Yahoo YQL】html table is no longer supported

2017-06-08

YQL select from html ( html table is no longer supported )

說明:已不提供支援

可以改抓 select from htmlpost  (you use htmlpost )
使用post ,但結果(RESULT) 會多一層   postresult

請在 call function 調整 讀取資料

change use htmlpost