Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In order to get around the Cross Domain request restrictions put in place by the <a href="http://en.wikipedia.org/wiki/Same_origin_policy" rel="nofollow">Same Origin Policy</a>, you need an endpoint that allows you to do a JSONP request or that has enabled CORS. Unfortunately, the Yahoo! Finance endpoint has neither.</p> <p>So, as James mentioned, you ned a middle man.</p> <p>Usually, my recommendation for this is to use <a href="http://developer.yahoo.com/yql/" rel="nofollow">YQL</a>, which allows you to quickly and easily build a server that sits between you and the finance site. In fact, they already have a Yahoo! Finance endpoint for exactly the data you're trying to get: <a href="http://developer.yahoo.com/yql/console/?q=select%20%2a%20from%20yahoo.finance.historicaldata%20where%20symbol%20=%20%22YHOO%22%20and%20startDate%20=%20%222009-09-11%22%20and%20endDate%20=%20%222010-03-10%22&amp;env=http://datatables.org/alltables.env" rel="nofollow">link</a></p> <p>However, as that can be unreliable, I also have a website scraper that I've used in various projects. It's hosted on Heroku and allows you to fetch almost any content from any site. I don't recommend using it for high volume projects, but for occaisional data fetches it's great. In your case, you would use it like this:</p> <p><a href="http://websitescraper.heroku.com/?url=http://ichart.finance.yahoo.com/table.csv?s=RIL.BO&amp;callback=jsCallback" rel="nofollow">http://websitescraper.heroku.com/?url=http://ichart.finance.yahoo.com/table.csv?s=RIL.BO&amp;callback=jsCallback</a></p> <p>Now that you have that out of the way, I recommend using jQuery and the <a href="https://code.google.com/p/csv-to-array/" rel="nofollow">csv-to-array plugin</a>:</p> <pre><code>jQuery.getJSON('http://websitescraper.heroku.com/?url=http://ichart.finance.yahoo.com/table.csv?s=RIL.BO&amp;callback=?', function (csvdata) { console.log(csvdata.csvToArray()); }); </code></pre> <p>Also, if you want to launch your own middle man, you can use the website-scraper that I've built. The <a href="https://github.com/jhubert/website-scraper" rel="nofollow">source code is on GitHub</a> and it's released under the MIT license.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload