skip to navigation
skip to content

Not Logged In

nytfrontpage 0.1.2

An API for downloading frontpages from the New York Times.

A small library to retrieve cover pages of the New York Times as images. Turns out the NYT hosts them and they’re all just sitting there. Who would have thought?

Install

$ pip install nytfrontpage

Usage

Here’s an example, runnable from the included demo.py file:

#!/usr/bin/env python
# coding: utf-8
import sys
from datetime import date

import nytfrontpage


if __name__ == '__main__':
  today = date.today()
  print 'Fetching image contents...'
  image_contents = nytfrontpage.get_image_data(today)
  if image_contents:
    with open('frontpage.jpg', 'w') as f:
      f.write(image_contents)
    print 'Successfully downloaded the frontpage.'
  else:
    print 'The frontpage image has not been posted yet.'
$ ./demo.py
$ open frontpage.jpg
 
File Type Py Version Uploaded on Size
nytfrontpage-0.1.2.tar.gz (md5) Source 2014-04-27 3KB
  • Downloads (All Versions):
  • 3 downloads in the last day
  • 39 downloads in the last week
  • 169 downloads in the last month