Skip to content

Abhimanyu-Gaurav/WebScraping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WebScraping

A simple web scraping project using Python's requests and BeautifulSoup to extract information from a website like Times of India.


Technologies Used

  • Python: Core programming language for backend logic.
  • Requests: For making HTTP requests and fetching the HTML code.
  • BeautifulSoup: For parsing and navigating through HTML data.

Table of Contents

  1. Project Description
  2. Key Features
  3. Installation
  4. How to Use
  5. License

Project Description

This project demonstrates how to scrape web pages using the requests module to fetch HTML and BeautifulSoup to parse and extract meaningful data. The code extracts various HTML elements like:

  • Paragraphs (<p>)
  • Headings (<h1>, <h2>)
  • Links (<a>)
  • Images (<img>)

It also shows how to extract specific content based on CSS class names or HTML IDs.


Key Features

  • Fetch HTML code from a website.
  • Parse and pretty-print the HTML structure.
  • Extract elements like title, paragraphs, links, and images.
  • Find specific content by class names and IDs.
  • Extract all links and image URLs on the page.

Installation

To install the required dependencies, follow these steps:

  1. Clone the repository:
    https://github.com/Abhimanyu-Gaurav/WebScraping
    
  2. Navigate to the project directory:
    cd WebScraping
    
  3. Install the dependencies:
    pip install -r requirements.txt
    

How to Use

  1. Modify the url variable in the script to the website you want to scrape.

  2. Run the script:

    python main.py
    
  3. The script will print extracted information such as:

    • Page title
    • Paragraph text
    • All links and images

License

  • This project is licensed under the MIT License - see the License file for details.

Releases

No releases published

Packages

No packages published

Languages