Issue
Its probably just a simple fix but all the methods I have looked at to get the Dogecoin price off of a this website gets the price, but with all of this other stuff. How do I just get the price without it inhibiting its ability to refresh? Here is what I currently have...
from bs4 import BeautifulSoup
import requests
url = 'https://www.coindesk.com/price/dogecoin/'
result = requests.get(url)
doc = BeautifulSoup(result.text, 'html.parser')
prices = doc.find_all(text="$")
parent = prices[10].parent
print(parent)
Solution
If you only want the text of an element, all you have to do is:
print(parent.text)
BeautifulSoup documentation can be found at https://beautiful-soup-4.readthedocs.io/en/latest/index.html
Answered By - platipus_on_fire
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.