Skip to content

Instantly share code, notes, and snippets.

@belkarx
Created February 11, 2023 04:41
Show Gist options
  • Select an option

  • Save belkarx/bfc87d06f1535c827b63bbfa41bab4f5 to your computer and use it in GitHub Desktop.

Select an option

Save belkarx/bfc87d06f1535c827b63bbfa41bab4f5 to your computer and use it in GitHub Desktop.
Get Quizlet Cards
wget $MY_URL --referer "google.com" --user-agent="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
cat index.html | grep -Po "window\.Quizlet\[\"MiniFlashcards\"\].*QLoad\(\"Quizlet\.MiniFlashcards\"\)" > json_object
# Python to parse json object
import json
data = open("json_object", "r").read()
json.loads(data[35:-33])
@belkarx

belkarx commented Feb 11, 2023

Copy link
Copy Markdown
Author
  • The referrer and user agent are necessary or quizlet returns a 403
  • The first two lines can be piped together, I just think having a temp file is useful for debugging
  • Put the python in another file
  • Would recommend formatting json_object and looking through the schema before doing anything with it. If you don't feel like doing that and want the easy answers, you can access the cards through:
for x in data["studiableDocumentData"]["studiableItems"][0]:
    x["cardSides"][0]["media"][0]["plainText"] #first side text
    x["cardSides"][1]["media"][0]["plainText"] #second side text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment