Skip to main content

Python library for querying Seinfeld quotes.

Depends on a database generated using scripts by Colin Pollick.

Install

libseinfeld is compatible with Python 2.7 and Python 3.3+. You can install it from PyPI with the following command:

$ pip install seinfeld

libseinfeld requires a local copy of the Seinfeld quote database. You can build it by following the instructions on the seinfeld-scripts repo, or you can download a prebuilt copy with the following command:

$ wget https://noswap.com/pub/seinfeld.db

Usage

First thing is to import libseinfeld and create a connection to the local database:

>>> from seinfeld import Seinfeld
>>> seinfeld = Seinfeld(<path to seinfeld.db>)

To get information on individual episodes or seasons:

>>> seinfeld.season(1).episodes.keys()
[1, 2, 3, 4]

>>> seinfeld.season(1).episodes[1].title
u'Good News, Bad News'

>>> seinfeld.season(1).episodes[1].writers[0]
u'Jerry Seinfeld'

>>> seinfeld.season(1).episodes[1].date
datetime.date(1990, 6, 14)

Quotes can be retrieved by unique ID:

>>> quote = seinfeld.quote(34665)
>>> quote.text
u'The show is about nothing.'

>>> quote.speaker.name
u'George'

>>> quote.episode.title
u'The Pitch'

Searching for quotes is simple:

>>> seinfeld.search(speaker='Jerry', subject='keys')
[Quote(...), ...]

Searches are limited to ten quotes by default, but you can get more or less. To get all the quotes, in order, for a given episode:

>>> episode = seinfeld.season(1).episodes[1]
>>> quotes = seinfeld.search(episode=episode, limit=None)
>>> len(quotes)
209

You can even get random quotes by search query:

>>> seinfeld.random(speaker='George')
Quote(...)

If you’d like context around an individual quote, you can get a passage:

>>> passage = seinfeld.passage(quote)
>>> len(passage.quotes)
5

License

Copyright 2016 John Reese, and licensed under the MIT license. See the LICENSE file for details.

Metadata

Release files for seinfeld 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seinfeld 1.0.1
File Size Uploaded
seinfeld-1.0.1.tar.gz 5.0 kB Details

Release files / seinfeld-1.0.1.tar.gz

Download URL seinfeld-1.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e7eb7f7b33b450feb3e1dc44b156a5d51f69c6a61e04c7ed50f17ec6a1224ca0
BLAKE2b-256 checksum
How to use checksums
a529f9220bb0539b0a86563be8bef9eabac253fbdada5873e605faf409a9e3b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page