Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f20effe

Browse files
bitcoin price tracker
1 parent ce7e971 commit f20effe

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

‎BITCOIN-price-tracker/1.png‎

11.4 KB
Loading[フレーム]

‎BITCOIN-price-tracker/tracker.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /