This project scrapes agricultural land listings from MagicBricks for properties in Patna. It extracts details such as property name, owner, location, area, dimensions, and price, and saves the data into a CSV file.
- Scrapes agricultural land listings from MagicBricks.
- Extracts relevant details about each property.
- Saves the data into a CSV file for easy analysis.
-
Clone the repository:
git clone https://github.com/your-username/agricultural-land-scraper.git cd agricultural-land-scraper
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Run the script:
python scraper.py
- The script will fetch the webpage, parse the HTML, and extract the relevant data.
- The data will be saved into a CSV file named
agricultural_land_bihar.csv
.
The script performs the following steps:
- Fetch the webpage: The script sends a request to the URL and fetches the HTML content.
- Parse HTML: It uses BeautifulSoup to parse the HTML content.
- Extract Data: The script finds all property listings and extracts details such as property name, owner, location, area, dimensions, and price.
- Save Data: The extracted data is saved into a CSV file using pandas.
requests
beautifulsoup4
pandas
You can install the required packages using:
pip install requests beautifulsoup4 pandas