Я пытаюсь отменить цену акций Yahoo Finance, используя Python и BeautifulSoup. Однако я не могу получить тег, имеющий указанный атрибут c «data-Reactiontid» (см. Скриншот). Пожалуйста, помогите мне.
Code:
def getCurrentPrice(self, stockSymbol):
#stockSymbol is : MSFT for Microsoft
url = "https://finance.yahoo.com/quote/{}".format(stockSymbol)
source = requests.get(url).text
soup = BeautifulSoup(source, 'lxml')
currentPrice = soup.find('span',attrs={"data-reactid": "52"})
print("{} : {}".format(stockSymbol, currentPrice))
Output:
MSFT : None
#None because the span tag is not being found.
