I am working on a crypto bot and was almost done completing my project. For weeks, my team has searched for Robinhood API that would return the constantly updating price of BTC. The code below was working for the past week on the whole team's computer, however now it refuses to work. I have tried using different parsers, but cannot figure out what the problem is now. It was working fine for so long, and now suddenly refuses to work. Any help would be appreciated!
from bs4 import BeautifulSoup
import requests
import json
# returns value of bitcoin from https://robinhood.com/crypto/BTC using BeautifulSoup
def getPrice():
price = ""
response = requests.get("https://robinhood.com/crypto/BTC") # Returns instance of Response class
response.encoding = 'utf-8' # Just in case the charset of response is not recognized
# crypto: bs4.BeautifulSoup = BeautifulSoup(response.content, 'html.parser')
# annotation format highlights what type of class the variable crypto is
# https://stackoverflow.com/questions/51639332/use-of-colon-in-variable-declaration
crypto = BeautifulSoup(response.content, "html.parser")
for digit in crypto.find_all("span", {"class": "_9YsRP4ChsxbL9qzZnKv0K up"}): # return type of find is object
if digit.text != '$' and digit.text != ',':
price += digit.text
return float(price)