D
D
dearname2014-02-01 20:04:33
Android
dearname, 2014-02-01 20:04:33

How to parse currencies from Yahoo?

I am writing a currency converter program, I am trying to grab the currency value at this address (where 'Exchange rate of...' is written at the bottom), but for some reason it does not come out.
finance.yahoo.com/currency-converter/#from=USD;to= ... - here is the address ...
Maybe yahoo somehow bypasses this kind of parsing, other data can be obtained, but it does not give this one, for example, I take out all the tags and this value does not come out, others come out.

try {
        doc = Jsoup.connect("http://finance.yahoo.com/currency-converter/#from=USD;to=EUR;amt=1").get();
        title = doc.getElementsByTag("p");
        
        titleList.clear();
        for (Element titles : title) {
          titleList.add(titles.text());
        }
        
        
      } catch (IOException e) {
        e.printStackTrace();
      }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lolshto, 2014-02-01
@Lol4t0

No need to parse sites. Take some service that provides quote data in xml or json.
For example,
www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

V
Vitaly Zheltyakov, 2014-02-01
@VitaZheltyakov

For the Russian Federation, it is customary to take official currency rates from the Central Bank:
cbr.ru/scripts/XML_daily.asp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question