Skip to content

Commit a134b67

Browse files
Merge pull request avinashkranjan#402 from pritamp17/bitcoin
Bitcoin Price Tracker
2 parents 1bb80a3 + 3683c6c commit a134b67

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

BITCOIN-price-tracker/1.png

11.4 KB
Loading

BITCOIN-price-tracker/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Get Real Time BITCOIN Price
2+
Python script that show's BITCOIN Pricr
3+
# Packages Used
4+
1. bs4
5+
2. requests
6+
# How to run
7+
**1.** Fork [this](https://github.com/avinashkranjan/Amazing-Python-Scripts) repository.
8+
**2.** Clone your forked copy of the project.
9+
```
10+
git clone https://github.com/<your_user_name>/Amazing-Python-Scripts.git
11+
```
12+
Navigate to the project directory.
13+
```bash
14+
cd Amazing-Python-Scripts/avinashkranjan/Amazing-Python-Scripts
15+
```
16+
# And here you go
17+
![](https://github.com/pritamp17/Amazing-Python-Scripts/blob/bitcoin/BITCOIN-price-tracker/1.png?raw=true)
18+
# Author
19+
[Pritam Pawar](https://github.com/pritamp17)

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)