A
A
Alexey2018-08-12 12:40:30
C++ / C#
Alexey, 2018-08-12 12:40:30

How to parse the yuan exchange rate from the bank's website?

I want to use NodeMcu and an oled screen to monitor the yuan (CNY) exchange rate on the site: https://www.pskb.com/currency/
But alas, they don’t have an API (at least open ones) and there’s nothing in the source code either cling (unique id, class, etc.).
I'm waiting for advice, maybe someone knows more ways (preferably with examples and links).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Terekhin, 2018-08-12
@RomaZveR

If you need a daily rate, and not from the exchange in real time, then take it from the Central Bank
www.cbr.ru/scripts/XML_daily.asp

D
Dimonchik, 2018-08-12
@dimonchik2013

xpath allows text search

xpath(('//div[@class="astra1" and contains(text(),"filename")]/following::div[1]/text()'))

E
Evgen, 2018-08-13
@Verz1Lka

import requests
from parsel import Selector

response = requests.get('https://www.pskb.com/currency/')
sel = Selector(text=response.text)
print sel.xpath('//div[@id="tab1"]//tr/td[strong[text()="CNY"]]/following-sibling::td[1]/text()').get()

By the way, I gave myself a script that checks the rate every 5 seconds, and if it goes out of the specified range, it signals this. For Tinkov, really. I will share if there is interest.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question