Skip to content

A scraper that scrapes checked out items from your chicago public library's account

Notifications You must be signed in to change notification settings

Ullas-Aithal/chicago-public-library-scaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Chicago Public Library (CPL) scraper

This python script will scrape cpl website to get the checked out items and due dates for the books you've borrowed. This script returns a json array of your books:

[
  {
    "book_title": "Cracking the Coding Interview",
    "days_remaining": "17 days remaining",
    "due_date": "Sep 10, 2019"
  },
  {
    "book_title": "Vicious",
    "days_remaining": "19 days remaining",
    "due_date": "Sep 12, 2019"
  }
]

How the script works

  • The script gets the login page first and extracts the csrf-token.
  • Then this crsf-token along with user credentials is POSTed
  • The session is now created. Another request is made to get the checked out items
  • Using BeautifulSoup the page is scraped to get the div items holding all the information required for each book

Installation

Enter your cpl user name and password in config.json file.

{
  "username" : "<<user_name>>",
  "password" : "<<password>>"
}

This is a python3 script and the scraping is done using BeautifulSoup package.

Install the requirements:

pip3 install requests, beautifulsoup4

Usage

python3 scarpe.py

You can also make this as an api call using Flask. You can look at my other project where I'm using this script as an api call using flask (link to be up soon)

Future features

Add hold item status to the json

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

A scraper that scrapes checked out items from your chicago public library's account

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages