Skip to main content

Know Your Meme scraper, a rewrite of memedict.

Project description

culturgen

culturgen is a Know Your Meme scraper.

It's originally based on an older scraper package called memedict (GitHub, PyPI).

Install

pip install culturgen

Usage

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

>>> 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:

>>> 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:

>>> 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.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

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

culturgen-0.2.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

culturgen-0.2.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file culturgen-0.2.1.tar.gz.

File metadata

  • Download URL: culturgen-0.2.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for culturgen-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b02fdaaaac7407e7b1ceb37f10cb3ac28008d8e32c992aaf4538517387c58572
MD5 f3f60c29231aadfc271bca715a9eb3ce
BLAKE2b-256 6cf3b8622fcc66df2e63826934c1e0c3038c33c93862781f8530d9576d887fcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for culturgen-0.2.1.tar.gz:

Publisher: pypi.yml on dgw/culturgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file culturgen-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: culturgen-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for culturgen-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec2fcaefddc791e08b17ef63a87ec8a1d92fb74a2f5e62f014f66dc3eb19af78
MD5 486025a60075c2986f9d58a2593a3d6c
BLAKE2b-256 90cc47e1fcdb3a01409fa7deecb1b8bbaeb0cf29dc3a9fcdd3c93c180fa1786e

See more details on using hashes here.

Provenance

The following attestation bundles were made for culturgen-0.2.1-py3-none-any.whl:

Publisher: pypi.yml on dgw/culturgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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