Why does it give me an error in class parsing?

Viewed 18

I'm trying to parse the dollar rate from the site https://yandex.ru/. He did everything according to all the canons. Tell me what's wrong?

response = requests.get('https://yandex.ru')
body = html.fromstring(response.text)
dollar = body.xpath('//span[@class="inline-stocks__value_inner"]/text()')[0]

The error is the following:

dollar = body.xpath('//span[@class="inline-stocks__value_inner"]/text()')[0]
IndexError: list index out of range
0 Answers
Related