Member-only story
Build a Netflix API Miner With Python
A command-line app to retrieve Netflix show information

I’m currently in the process of building an Android app that randomly picks a show to watch on Netflix. To do that, I needed access to up-to-date show information. While Netflix itself doesn’t provide an official public API, the next best thing is offered by unogsNG, which provides both a website and an API service that does just that.
Initially, the idea was to issue an API request every time a user needed a random show to be picked. However, upon learning that you only get 100 free requests per day and are charged per request beyond that, I realized I needed to change strategies.
What I came up with was a Python script that continuously queries the API service without exceeding the daily quota and then sleeps until the quota is reset. This is repeated until all show information has been retrieved. Then, instead of using live data, the app would use locally stored information.
Algorithm
In order to write the script, I needed to understand exactly how the API service operated. Here are the main points:
- 100 free requests per day
- Up to 100 results per request
- Daily quota resets at time of subscription to API service
- Each response includes a header that shows the number of free requests remaining
With this information in hand, the algorithm can be visualized as follows:

Components and Dependencies
The program can be broken down into three parts. First, the main entry point, which involves the logic responsible for API requests, data storage, usage monitoring, etc. Here, we’ll rely on Requests, a simple HTTP library, for communicating with the API service.
The second component involves scheduling the execution of the aforementioned logic. This essentially means setting the quota reset time and waiting for it before issuing a new batch of requests, or waiting if the initial batch…