Coders Packet

Python script to fetch current crypto currency price

By Omprakash Biswas

This piece of code will scrape the google search result and find the current crypto price.

Before we proceed we have to install some libraries. The libraries are as follows :

Note: To install these packages you need to go to command-prompt(windows)/terminal(linux)

Request: Requests make it very simple to send HTTP requests.

pip install requests

 

BeautifulSoup: Beautiful Soup is a package that makes scraping data from web pages simple. It sits on top of an HTML or XML parser.

pip install beautifulsoup4

 

Lxml: It is a parser on which BeautifulSoup works.

pip install lxml

Step1: Ask the user to give the crypto name.

Step2: Make a suitable URL for google search

Step3: Catch the Request as a text file to see the web content

Step4: Make a soup using BeautifulSoup with lxml parser.

Step5: By inspecting google search results collect the appropriate div, class, etc of the html.

Step6: Print the result

Output:

Output

Note: Code is useful for coinbase databases especially bitcoin and ethereum

Download Complete Code

Comments

No comments yet