I am lazy man so it's too much for me to open a browser and check for the today free offer from packtpub.com
Here is a little script to tell me just thas. Eventually I could put some notification and asign a shortcut key combination to run it. I love Linux :)
Here is a little script to tell me just thas. Eventually I could put some notification and asign a shortcut key combination to run it. I love Linux :)
from selenium import webdriver from bs4 import BeautifulSoup url = "https://www.packtpub.com/packt/offers/free-learning" driver = webdriver.PhantomJS() driver.get(url) html = driver.page_source soup = BeautifulSoup(html, "lxml") expire_time = soup.find('span', class_='packt-js-countdown').text.strip() book_title = soup.find('h2').text.strip() print('The free book for today from https://www.packtpub.com is') print('"{}"'.format(book_title)) print('Expire in: {}'.format(expire_time))