File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
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 )
Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments