0

What I am trying to do is make a code that converts RUB into PLN using exchange rates of 2 banks, the first one of which is here: https://qiwi.com/payment/exchange I'm trying to get the selling rate of yuans. What so ever,

tags that I extracted seem not to contain it at all, unlike "buying", "selling" and "currency" labels. What did I do wrong and why is this web page so hard to read?

#libraries
import mechanicalsoup
from bs4 import BeautifulSoup
import re

#going to the website and extracting tags
browser=mechanicalsoup.Browser()
page=browser.get("https://qiwi.com/payment/exchange")
html=page.soup
print(type(html), '\n\n', page)
indexea=html.find_all('p')
for idx in indexea:
  print(idx)

print(len(indexea))

#variable=indexea[{this is the lien with rubble-yuan exchange rate}] 

print()
  • 1
    [MechanicalSoup](https://mechanicalsoup.readthedocs.io/en/stable/) doesn't do Javascript, and that's what used here to construct the page's content. – KIKO Software Dec 14 '22 at 12:53
  • @KIKOSoftware Thank you very much for your reply. Could you also advise another way to construct the page's content, that supports Javascript? Or is it impossible in python? This, what I tried immediately after, doesn't work either: ```from bs4 import BeautifulSoup from urllib.request import urlopen import re page=urlopen("https://qiwi.com/payment/exchange").read().decode("utf-8") html=BeautifulSoup(page, "html.parser") #print(type(html), '\n\n', page) indexea=html.find_all('p') for idx in indexea: print(idx, '\n') print(len(indexea))#prints "0" ``` – AleksyStrzecki Dec 14 '22 at 13:53
  • I would not bother with a site that tries so hard to hide their content. There must be an easier, and more reliable, way to get the exchange rates of currencies. Try to use an API. – KIKO Software Dec 14 '22 at 15:40

0 Answers0