Brad Lucas

Programming, Clojure and other interests
April 7, 2020

Yahoo Finance Quote Download Java Update

Overview

Back in June of 2017 I posted an article describing how to retrieve quotes from the Yahoo Finance page.

Original Article

http://blog.bradlucas.com/posts/2017-06-04-yahoo-finance-quote-download-java/

The other day I received a message from a user who found that the program no longer worked. After looking into the issue I found that Yahoo responds differently depending on the User-Agent setting being presented to the server. The quick fix was to change the value submitted.

Original

        request.addHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13");

New

        request.addHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:74.0) Gecko/20100101 Firefox/74.0")

Updating Source Code

https://github.com/bradlucas/get-yahoo-quotes-java

Tags: yahoo java quotes trading