File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
WebScrapingScripts/Real-Time Bitcoin Rate Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change
1
+ # BeautifulSoup is a python library for pulling data out of HTML and XML files
2
+ from bs4 import BeautifulSoup as BS
3
+ # requests module allows you to send HTTP requests and returns a Response Object with all the response.
4
+ import requests
5
+ def get_price (url ):
6
+ data = requests .get (url ) # Accessing all required data from url site and store in data.
7
+ soup = BS (data .text ,"html.parser" ) # It takes text of page as argument and then parse it with html.parser
8
+ ans = soup .find ("div" ,class_ = "BNeawe iBp4i AP7Wnd" ).text # here the class name is passed as argument to find out that particular info in html text
9
+ return ans
10
+ url = "https://www.google.com/search?q=bitcoin+price"
11
+ ans = get_price (url )
12
+ print ("1 Bitcoin = " ,ans )
You can’t perform that action at this time.
0 commit comments