Scraper for used vehicles at BMW dealerships in Spain.
The target page is https://www.bmwpremiumselection.es
This project was created for purely educational purposes.
The script allows you to add a specific search model with filters and receive notifications about new vehicles for sale.
It also has a function to check price changes.
- Python 3
- Requests
- Pandas
- BeatifulSoup4
- Pytest
- Python-dotenv
Install with:
pip install -r requirements.txtGmail account or another email provider that allows third-party application access for SMTP configuration is needed.
In the case of setting up a Gmail account, two-step verification must be activated and application passwords (pass_smtp) must be generated in the account that will send the emails.
Official guide: https://support.google.com/mail/answer/185833?hl=en
Inside the email_alert folder is mail_user_data.env that will contain the variables for sending emails.
mail_smtp=xxxx
pass_smtp=xxxx
sender_email=xxxx
receiver_emails=xxxxIn the input file input_search.csv you can set yor search. For fields without filter set "_".
model,motor,price,kms,after_year,before_year,email
serie-1,128ti,_,_,2025,_,False
serie-3,320i,30000,_,_,_,TrueThe email value can be set to True or False to receive or not receive news alerts.
The output data is stored in the data.csv file where the id and url to each vehicle found is filed.
id,url,price
xxxxxxx,https://www.bmwpremiumselection.es/xxxxxxxx,xx
xxxxxxx,https://www.bmwpremiumselection.es/xxxxxxxx,xx
xxxxxxx,https://www.bmwpremiumselection.es/xxxxxxxx,xx- New params to search
- Store dates to record changes over time
- Containerize the application using Docker
- Scrape more data like kms/fuel
- Scrape for specific countries/provinces
- New forms of notification
For support, write me an email yanez.vc@gmail.com.