Web Scraping using Python
What is web scraping?
Web scraping is the process of using bots to extract content and data from a website. Using web scarping we can store unstructured website data to structured website data.
Scrap data from website using python.
To scrap data from website using python we will use three libraries.
requests : The request library allow to send HTTP request using python. Using this library you can send request to URL for use that data.
BeautifulSoup : BeautifulSoup collect data from HTML and XML documents.
Pandas : Pandas is Python package that is for data analysis and manipulation. It will collect data and store that in proper format.
Steps to scrape data from websites
- Find the URL that you want to scrape
In this blog we are going to scrape Flipkart website for product info.
We will scrap data from above URL.
2. Inspecting the Page and find data that you want
Right click on website and click on inspect
find tag of data that you want to scrape
3. Write the code
import libraries
Store webpage content using requests and BeautifulSoup.
Separate specific data from content using respective class-names and respective tags. and store that data into list.
We can print or store data for further use
output data
For whole code, check my GitHub.
Thank You.