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

Changelog

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.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.0.tar.gz (6.4 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.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: culturgen-0.2.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for culturgen-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c7a5dc1bd1319f47fecdddb765b77e2de652d7cdc61b9368447c6faf664be873
MD5 cb7d114cc941e7271f3c27237067e61f
BLAKE2b-256 67cbda4cce6a0f8be824e5a107c323a276ee38bfbf6a247bd029c6852d16b323

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: culturgen-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for culturgen-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4833971baadbd009cddb300aa561c2c4639333a95e79e32af056481be57610f
MD5 8e2ac3949d1fb9b9f86f388b79f4c445
BLAKE2b-256 881a0e5ede7cc882e8ce246145165c0185d977179e7eeb225c1fd1baf24de814

See more details on using hashes here.

Provenance

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