Answer the question
In order to leave comments, you need to log in
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
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
xpath allows text search
xpath(('//div[@class="astra1" and contains(text(),"filename")]/following::div[1]/text()'))
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()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question