Skip to content

A scraper npm package to search and get information about memes from KnowYourMeme.com

Notifications You must be signed in to change notification settings

muhammadrizo-y/knowyourmeme-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Know Your Meme JS

A scraper npm package to search and get information about memes from KnowYourMeme.com.

GitHub: knowyourmeme-js

Features

  • 🔍 Search memes by query with customizable result limits
  • 📖 Get detailed meme information including images, tags, origin, and more
  • 🚀 Fast and lightweight using Cheerio for HTML parsing
  • 📦 ES6 modules support
  • 🔵 TypeScript support
  • 🛡️ Error handling with descriptive error messages

Installation

npm install knowyourmeme-js

Usage

Basic Search

import { search } from 'knowyourmeme-js';

// Search for memes
const results = await search('shrek');
console.log(results);

Search with Options

import { search } from 'knowyourmeme-js';

// Search with custom limit
const results = await search('shrek', 5); // default is 10
console.log(`Found ${results.length} results`);
console.log(results);

Get Meme Details

import { getMeme } from 'knowyourmeme-js';

// Get detailed information about a specific meme
const meme = await getMeme('https://knowyourmeme.com/memes/shrek-rizz');
console.log(meme);

API Reference

search(query, options)

Searches for memes on KnowYourMeme.com.

Parameters:

  • query (string): Search query
  • max (number): Maximum number of results (default: 10)

Returns: Promise - Promise resolving to an array of MemeResult

Search Result Object:

{
  title: string,
  link: string,
  thumbnail: { url: string, alt: string }
}

getMeme(url)

Gets detailed information about a specific meme.

Parameters:

  • url (string): URL of the meme page on KnowYourMeme.com

Returns: Promise - Promise of MemeDetails

MemeDetails Object:

{
  title: string,
  link: string,
  image: { url: string, alt: string },
  views: number | null,
  sections: MemeSection[],
  googleTrends: string,
  type: string[],
  year: string,
  origin: string,
  region: string,
  tags: string[]
}

Requirements

  • Node.js 14.0.0 or higher
  • ES6 modules support

Dependencies

  • axios: HTTP client for making requests
  • cheerio: HTML parsing and manipulation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Disclaimer

This project is not affiliated with or endorsed by KnowYourMeme.com.
It simply scrapes publicly available data for educational and personal use.
Please use this library responsibly and respect the website’s Terms of Service.

About

A scraper npm package to search and get information about memes from KnowYourMeme.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published