https://github.com/amyreese/libseinfeld
Python library for querying Seinfeld quotes
https://github.com/amyreese/libseinfeld
python quotes seinfeld seinfeld-television
Last synced: 29 days ago
JSON representation
Python library for querying Seinfeld quotes
- Host: GitHub
- URL: https://github.com/amyreese/libseinfeld
- Owner: amyreese
- License: mit
- Created: 2016-01-16T01:30:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-24T06:08:05.000Z (almost 3 years ago)
- Last Synced: 2025-04-20T19:48:55.788Z (about 2 months ago)
- Topics: python, quotes, seinfeld, seinfeld-television
- Language: Python
- Size: 16.6 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
libseinfeld
===========Python library for querying Seinfeld quotes.
Depends on a database generated using `scripts by Colin Pollick`_.
.. image:: https://travis-ci.org/amyreese/libseinfeld.svg?branch=master
:target: https://travis-ci.org/amyreese/libseinfeldInstall
-------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()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)
209You 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)
5License
-------Copyright 2022 Amethyst Reese, and licensed under the MIT license.
See the ``LICENSE`` file for details... _scripts by Colin Pollick: https://github.com/colinpollock/seinfeld-scripts
.. _seinfeld-scripts repo: https://github.com/colinpollock/seinfeld-scripts