npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

quizlet-fetcher

v3.0.0

Published

HTML parser for Quizlet flashcards decks

Downloads

25

Readme

quizlet-fetcher

Scraper for Quizlet sets (flashcards) to download them.

API

Node.js

Note: functionality to download cards was removed in 1.1.0. You'll need to provide the webpage yourself.

Note: As of now, you'll need to be authenticated to get all of the cards. This is because Quizlet will only provide the full set to authenticated users.

npm install quizlet-fetcher
# or
yarn add quizlet-fetcher
// ESM
import QuizletFetcher from "quizlet-fetcher"
// CJS
const QuizletFetcher = require("quizlet-fetcher").default

const quizlet = new QuizletFetcher(html) 

// Get the cards as JSON
// See below for format
quizlet.getJSON()

It's that simple. It should output something like this:

{
   "title":"Basic Japanese Phrases",
   "description":"Basic phrases from romaji to English",
   "author": "user123456",
   "cards":[
      {
         "term":"お げんき です か",
         "definition":"How are you?"
      },
      {
         "term":"わたし は げんき です, ありがとう",
         "definition":"I'm fine, thanks."
      },
      {
         "term":"さいきん どう です か",
         "definition":"What's new?"
      },
      {
         "term":"かわらない です",
         "definition":"Nothing much."
      },
      {
         "term":"すみません",
         "definition":"Excuse me",
         "image": "https://quizlet.com/cdn-cgi/image/f=auto,fit=cover,h=100,onerror=redirect,w=120/https://example.com/3826462.jpg",
         "sourceImage": "https://example.com/3826462.jpg"
      },
      {
         "term":"わたし と いっしょ に きて ください",
         "definition":"Come with me.",
         "image": "https://quizlet.com/cdn-cgi/image/f=auto,fit=cover,h=100,onerror=redirect,w=120/https://example.com/381937.jpg",
         "sourceImage": "https://example.com/381937.jpg"
      },
      {
         "term":"あなた は えいご/にほんご を はなします か",
         "definition":"Do you speak English/Japanese?",
         "image": "https://quizlet.com/cdn-cgi/image/f=auto,fit=cover,h=100,onerror=redirect,w=120/https://example.com/1767281.jpg",
         "sourceImage": "https://example.com/1767281.jpg"
      }
   ]
}

Note: the image field is a proxy image, usually from the CDN. sourceImage is the real image. You'll most likely want to use sourceImage

Browser

There is a folder named dist. It contains a browserified version of the parser. You can follow the above example, replacing require or import with window.QuizletFetcher.

You can compile it yourself using this command:

npm build

Example:

<script src="dist/index.min.iife.js"></script>
<script>
var html = document.body.innerHTML
console.log(window.QuizletFetcher(html)) // prints JSON, see example above
</script>

Projects using this

Feel free to add your project here if you are using it.

Changelog

  • 1.0.0 - Inital version
  • 1.0.1 to 1.0.3 - Small bug fixes
  • 1.1.0 - Dropped CLI and automatic fetching due to Cloudflare issues
  • 2.0.0 - Moved to a class based system + did refactoring
  • 2.1.0 - Added image + author metadata. Added JSDoc types as well.
  • 3.0.0 - [Current] Added ESM support alongside with CJS and IIFE support (@reesericci)