Skip to content

MuhammadRuby/Cairo-Weather-Scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Cairo Weather Scraper 🌤️

A Python-based web scraping project that collects real-time weather data for Cairo, Egypt, stores it in a SQLite database, and allows easy analysis using Pandas.


📌 Project Overview

This project automatically scrapes current weather data from freemeteo.com and saves it into a local SQLite database. The collected data can later be queried using SQL or analyzed with Pandas for data science and analytics purposes.

The script simulates a browser request to avoid HTTP 403 errors and runs at timed intervals to build a historical weather dataset.


🧩 Features

  • Scrapes real-time weather data for Cairo

  • Extracts:

    • 🌡️ Temperature
    • 🌬️ Wind Speed
    • 💧 Humidity
    • 👁️ Visibility
    • 🌪️ Pressure
    • ⏱️ Timestamp
  • Stores data in a SQLite database

  • Reads data using SQL queries

  • Loads data into Pandas DataFrames for analysis


🛠️ Technologies Used

  • Python
  • Requests
  • BeautifulSoup
  • SQLite3
  • Pandas
  • Datetime & Time

📂 Database Schema

Database Name: Cairo_Weather.DB

Table: weather

Column Type
id INTEGER (Primary Key)
temp INTEGER
wind INTEGER
humidity INTEGER
visibility INTEGER
pressure INTEGER
time_now DATETIME

🚀 How to Run the Project

  1. Clone the repository
git clone https://github.com/MuhammadRuby/Cairo-Weather-Scraper.git
  1. Install required libraries
pip install requests beautifulsoup4 pandas
  1. Run the script
python weather_scraper.py

The script will:

  • Fetch weather data every 5 seconds (10 iterations)
  • Store the data in SQLite
  • Print collected values to the console

📊 Data Analysis Example

import sqlite3
import pandas as pd

conn = sqlite3.connect("Cairo_Wather.DB")
df = pd.read_sql("SELECT * FROM weather", conn)
conn.close()

print(df.head())

⚠️ Notes

  • Website structure changes may break the scraper
  • This project is for educational purposes only
  • Always respect website terms of service

Great work & happy coding! 🚀

About

A Python-based web scraping project that collects real-time weather data for Cairo, Egypt, stores it in a SQLite database, and allows easy analysis using Pandas.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors