Skip to main content

A package to scrape the current NYT Mini Leaderboard.

Project description

NYT Leaderboard Scraper

A Python package to log in as a user and scrape their current leaderboard for the NYT Mini.

Installation

pip install nyt-leaderboard-scraper

Usage

"""This script scrapes the leaderboard and prints the scores."""

from nyt_leaderboard_scraper import scraper

NYT_S_COOKIE = "YOUR_NYT_S_COOKIE_HERE"

session = scraper.create_requests_session(NYT_S_COOKIE)
score_collection = scraper.scrape_leaderboard(session)
session.close()

print(score_collection)

How to get your NYT-S Cookie

  1. Open a browser and log into NYT Games.
  2. Open the web developer tools (aka inspect element or DevTools).
  3. Navigate to Application > Cookies > NYT-S and copy the value you see there.

Note:

  • The instructions above might not apply directly but should work in general as long as your browser has DevTools.
  • The NYT-S cookie should be valid for about 6 months.

Why build this?

A friend of mine was manually recording our scores in a CSV file for data analysis.
In order to save their time, I built a cron job that runs twice a day, scrapes my leaderboard, and uploads those scores to a SQL database.
The Python code for that cron job makes use of this Python library.
Check out that project at NYT-leaderboard-app.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nyt_leaderboard_scraper-0.0.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nyt_leaderboard_scraper-0.0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file nyt_leaderboard_scraper-0.0.2.tar.gz.

File metadata

  • Download URL: nyt_leaderboard_scraper-0.0.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for nyt_leaderboard_scraper-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6691677d655ce56bf9b3c45c9d4e9d1b5c5ec4681c87af7f0c3123ed318d643e
MD5 4bf81ff201433a61e2b1a03f7728bdf2
BLAKE2b-256 6dbd301809a7d57e0a7cca8584d6f61c61335520e21b75e700ae602c327711d7

See more details on using hashes here.

File details

Details for the file nyt_leaderboard_scraper-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for nyt_leaderboard_scraper-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a576330b33eb29985a307e13f06c408b58ac0dbe00355448545647120df5c537
MD5 459bed251788cd287c3e194d1080155f
BLAKE2b-256 788049ac459ece5135ef722345fd4501c608beba6a385304f86172dcc7470dfc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page