Python 3 Script to Scrape Realtime Bitcoin Price Tracker From Google Search Using BeautifulSoup4 Library Full Project For Beginners



In order to get started you need to install the below libraries using the pip command as shown below



pip install requests



pip install beautifulsoup4



After this you need to make an file and copy paste the following code



# importing libraries
from bs4 import BeautifulSoup as BS
import requests

# method to get the proce of bit coin
def get_price(url):
    # getting the request from url
    data = requests.get(url)

    # converting the text
    soup = BS(data.text, 'html.parser')

    # finding metha info for the current price
    ans = soup.find("div", class_ ="BNeawe iBp4i AP7Wnd").text
    # returnng the price
    return ans

# url of the bit coin price
url = " / search?q = bitcoin + price"

# calling the get_price method
ans = get_price(url)

# printing the ans

Leave a Reply