We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce7e971 commit f20effeCopy full SHA for f20effe
BITCOIN-price-tracker/1.png
11.4 KB
BITCOIN-price-tracker/tracker.py
@@ -0,0 +1,17 @@
1
+import requests
2
+from bs4 import BeautifulSoup
3
+import time
4
+
5
+# create a function to get price of cryptocurrency
6
+def get_latest_crypto_price(coin):
7
+ url = 'https://www.google.com/search?q='+(coin)+'price'
8
+ # make a request to the website
9
+ HTML = requests.get(url)
10
+ # Parsse the HTML
11
+ soup = BeautifulSoup(HTML.text, 'html.parser')
12
+ # find the current price
13
+ texti = soup.find('div', attrs={'class':'BNeawe iBp4i AP7Wnd'}).find({'div':'BNeawe iBp4i AP7Wnd'}).text
14
+ return texti
15
16
+price = get_latest_crypto_price('bitcoin')
17
+print('BITCOIN price : ' + price)
0 commit comments