A Python script for scraping classified ads and sending a summary email.
- Python 3.x
- Redis (for Celery)
-
Clone the repository:
git clone <repository-url> cd classified-scraper
-
Install the dependencies With pip (note it's recommended to use virtual environment)
pip install -r requirements.txt
With pipenv
a. Install pipenv
b. pipenv shell
and pipenv install
on the virtual environment
- Create a .env file in the project root and add the following
GOOGLE_PASSWORD=your_google_password ### Recommended to use 2 step authorization + app passwords ### PERSONAL_EMAIL=your_personal_email@gmail.com
Running the scraper
python run.py
- Start the Celery worker:
celery -A tasks worker --loglevel=info
- Start the Celery beat for scheduled tasks:
celery -A tasks beat --scheduler celery.beat.PersistentScheduler
classified_scraper.py: Contains the ClassifiedScraper class for scraping ads.
json_handler.py: Contains the JsonHandler class for loading and updating data in a JSON file.
mailer.py: Contains the EmailSender class for sending emails.
run.py: Main script for running the scraper and sending emails.
celery.py: Configuration file for Celery.
tasks.py: Celery task definition.
This project is licensed under the MIT License - see the LICENSE file for details