Skip to content

Python bot that scrapes Walmart's clearance page for electronics to find the best deals and post them on Twitter automatically

Notifications You must be signed in to change notification settings

MousaZourob/Sahib

Repository files navigation

Sahib

Overview:

Python bot that scrapes Walmart's clearance page for electronics to find the best deals and post them on Twitter automatically. The bot scrapes data using the Selenium framework for Python, and the data is then stored in a MongoDB collection to be tweeted later. Using Windows Task Scheduler, the script was made into a CRON job to tweet 5 deals daily.

Data Flow:

Scraping from Walmart:

1. Using Geckodriver, a Webdriver for Firefox is created that opens Walmart's clearance page for electronics
2. The products are then scrapped using Selenium, and data such as the product's title, new and old price, and when it was scrapped is recorded
3. Calculations are done to determine the discount percentage and price, and then using DNSPython products are sent to be stored in a MongoDB collection

Scraping from Twitter:

1. Using Geckodriver, a Webdriver for Firefox is created that opens Twitter's log-in page
2. The script then checks if cookies saved as JSON objects for an older log-in exist, and if not logs in normally
3. Afterwards a connection with MongoDB is established, and the script finds the first 5 postings that haven't been tweeted
4. Using Selenium tweets are sent out over a 3 minute period, each with one of 8 template messages to publish new deals, and the posting date is saved in the database to not allow duplicate postings to occur
5. This script was turned into a CRON job using Windows Task Scheduler, and it runs automatically once a day to tweet out 5 deals daily

Demo:

  • To view the bot in action, click here: Demo

Libraries and Frameworks Used:

About

Python bot that scrapes Walmart's clearance page for electronics to find the best deals and post them on Twitter automatically

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published