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

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.2.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.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: culturgen-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7ccd89fdb364c9f5be5bae756b06f878834df49beada188d53da259ec6baffec
MD5 a3ff1b5689540c2d4bf00d6a7dd756e9
BLAKE2b-256 6b303feada989b3b82ed9428861476ef633dfb29afc8d41404d11f0b961322ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for culturgen-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: culturgen-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c41114ab533595b99a65dba2e9784324fd9c0047b7a3e7c5056bba5f3a60cff4
MD5 06bfab3aff3525afe74d0471abc0ba3d
BLAKE2b-256 a15b727cd67b832168d39d12c441ea2684c589ea9d03331be5e5d5d7f66cda60

See more details on using hashes here.

Provenance

The following attestation bundles were made for culturgen-0.2.2-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