Metadata-Version: 2.4
Name: culturgen
Version: 0.2.2
Summary: Know Your Meme scraper, a rewrite of memedict.
Author-email: dgw <dgw@technobabbl.es>
License-Expression: MIT
Project-URL: Homepage, https://github.com/dgw/culturgen
Project-URL: Bug Tracker, https://github.com/dgw/culturgen/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.10
Requires-Dist: beautifulsoup4>=4.5
Dynamic: license-file

# culturgen

`culturgen` is a Know Your Meme scraper.

It's originally based on an older scraper package called `memedict`
([GitHub](https://github.com/Kraymer/memedict),
[PyPI](https://pypi.org/project/memedict/)).

## Install

```sh
pip install culturgen
```

## Usage

Use `search()` to get a quick meme definition based on keywords:

```pycon
>>> import culturgen
>>> culturgen.search('all your base')
All Your Base Are Belong To Us. "All Your Base Are Belong to Us" is a popular
engrish catchphrase that grew popular across the internet as early as in 1998.
An awkward translation of "all of your bases are now under our control", the
quote originally appeared in the opening dialogue of Zero Wing, a 16-bit
shoot'em up game released in 1989. Marked by poor grammar, the "All Your Base"
phrase and the dialogue scene went viral on popular discussion forums in 2000,
spawning thousands of image macros and flash animations featuring the slogan
both on the web and in real life.
```

If you have a link to the Know Your Meme page (supports paths matching
`/memes/:slug` only), you can directly fetch information about that meme:

```pycon
>>> import culturgen
>>> culturgen.fetch('https://knowyourmeme.com/memes/mocking-spongebob')
Mocking SpongeBob. Mocking SpongeBob, also known as Spongemock, refers to an
image macro featuring cartoon character SpongeBob SquarePants in which people
use a picture of SpongeBob to indicate a mocking tone towards an opinion or
[...]
```

You can also do this with just the meme slug, handy for chat bot link handlers:

```pycon
>>> import culturgen
>>> culturgen.fetch('all-your-base-are-belong-to-us')
All Your Base Are Belong to Us. "All Your Base Are Belong to Us" is a popular
engrish catchphrase that grew popular across the internet as early as in 1998.
An awkward translation of "all of your bases are now under our control", the
[...]
```

## "AI" disclosure

Small portions of this codebase were partially generated by "AI" tooling. Tool
output was human-edited before being committed, and the offending code regions
are verbosely demarcated by comments disclaiming the use of an LLM.

No "AI" tool has or will ever be set loose in this project on a task larger than
one single function body. Its human author refuses to delegate anything like API
design to some giant, glorified autocomplete.

## Changelog

### 0.2.2

* Fixed syntax mistake in section text fetching...

### 0.2.1

* Reworked utility function responsible for fetching section text
* Modernized package metadata

### 0.2.0

This version drops the development status back to "4 - Beta" because of some
experiments like changing how `search_meme()` fetches results.

Stick with `culturgen==0.1.0` if you want "`memedict`, but fixed, but not trying
new things yet". KYM site changes can always break stuff—it's the nature of HTML
scraping—but between here and 1.0.0 there will _also_ be library API changes,
and design/implementation missteps to correct.

* New `fetch()` function that works with a KYM page URL or slug
  * Useful if you already have the URL or slug, and more reliable than the old
    workaround (try to search for the slug with `-` replaced by ` `)
* The `search_meme()` function now calls the "quick links" backend that KYM's
  own search bar uses
  * Undocumented, of course, and subject to breaking (just like scraping HTML
    from the search result page was, to be fair)
* Extracted some lower-level logic into a `util` submodule (not considered
  public API; available functions and their behavior subject to change!)

### 0.1.2

* Fixed incorrect return value format of `search_meme()` URL field

### 0.1.1

* Made similarity threshold check case-insensitive

### 0.1.0

* Updated to fix apparent changes from KYM that broke the old library
* Modernized package metadata
* Made a few miscellaneous tweaks
