3.1.5 • Published 9 months ago

moodle-scrape v3.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

moodle-scrape

NPM Docs Easily scrape data from Moodle sites. Tested on Moodle v3.8.

Features:

  • user info
  • courses
  • tasks/deadlines/events
  • course files/resources (#1)

Installation

npm install moodle-scrape
const { Moodle } = require("moodle-scrape"); // CommonJS
// or
import { Moodle } from "moodle-scrape"; // ESM

Usage

const moodle = new Moodle(fetch, "https://examplesite.com");

await moodle.login("supercoolusername", "superCoolpassword123");
// returns true if login was successful

console.log(moodle.user.name); // string
console.log(moodle.courses); // array of course objects
console.log(moodle.tasks); // array of task objects

or view the example CommonJS script

Scraping manually

After calling .login(), the cookies property gets filled with a string containing your cookies which you can pass to your own fetch method. For example:

await moodle.login("username", "password");

const res = await fetch("https://examplesite.com", {
  headers: { cookie: moodle.cookies },
});
// ...
3.1.3

11 months ago

3.1.2

11 months ago

3.1.1

11 months ago

3.1.5

9 months ago

3.1.4

11 months ago

3.1.0

1 year ago

3.0.0

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago