Skip to content

Instantly share code, notes, and snippets.

View jeffreymeng's full-sized avatar

Jeffrey Meng jeffreymeng

View GitHub Profile
@jeffreymeng
jeffreymeng / README.md
Last active June 3, 2023 21:53
Canvas Quiz Scraper

This script can scrape the quiz result view of canvas, capturing questions, answers, and images. It automatically downloads a JSON file with the scraped data, and downloads each image individually. The scraped data will track your selected answers (independent of whether they are correct). This script is designed to be run in the chrome dev console. You will need to first load jquery if it is not in scope, which can be accomplished by going to the jquery website and copy-pasting the jquery.min.js file into the console.

Due to the nature of web scraping, you may need to adapt this code to fit the specific page semantics you're working with.

from collections import defaultdict
import os
import discord
from discord import Message
from dotenv import load_dotenv
intents = discord.Intents.default()
intents.message_content = True