Showing posts from June, 2020

How To Crawl Coupon Sites With Python

In this post, I will show you how to use Python and LXML to crawl coupons and deals from coupon sites. The purpose of this post is to help users write crawlers with Python. To demo this, I will crawl coupons from and Example 1 Let us start with first. Let us first import the following two libraries.. import requests import lxml.html Most of the coupon sites have thousands of coupon pages. Most of the times, these pages are per company or site. These pages are structured templates. Therefore when we write a crawler for one coupon page, then it should work for all the coupon pages. In the case of couponannie also, this is the case. Let us pick the following url and extract the coupons and its related information. url = '' We will use requests to get the content of above page as shown below. obj = requests.get(url) Let us convert the data in to