{"id":20332380,"url":"https://github.com/zeroby0/lms-scraper","last_synced_at":"2025-10-15T02:51:36.669Z","repository":{"id":175198208,"uuid":"90649056","full_name":"zeroby0/lms-scraper","owner":"zeroby0","description":"Moodle LMS Scraper - IIITB","archived":false,"fork":false,"pushed_at":"2019-02-06T14:40:37.000Z","size":209,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T17:16:28.674Z","etag":null,"topics":["api","iiitb","lms","moodle","scraper"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroby0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-08T16:22:54.000Z","updated_at":"2021-10-07T07:00:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"29ea2448-02a5-44be-9d47-d518a8d04294","html_url":"https://github.com/zeroby0/lms-scraper","commit_stats":null,"previous_names":["zeroby0/lms-scraper"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Flms-scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Flms-scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Flms-scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroby0%2Flms-scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroby0","download_url":"https://codeload.github.com/zeroby0/lms-scraper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482921,"owners_count":21111400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","iiitb","lms","moodle","scraper"],"created_at":"2024-11-14T20:26:22.222Z","updated_at":"2025-10-15T02:51:36.539Z","avatar_url":"https://github.com/zeroby0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LMS Scraper\n\nScraper for IIITB LMS Client. This project is under active development and is not ready for production, just yet.\n\nScrapes [IIITB Moodle LMS](https://lms.iiitb.ac.in/moodle/login/index.php) and returns data as `json`. For use as API layer of IIITB LMS Client (yet to be built).  \n\nPlease note that the API is expected to change rapidly before a stable release.\n\n## Get Started  \n\nThis is a reiteration of [LMS client](https://github.com/zeroby0/IIITB-LMS-Client-OLD) built in Java as a part of course curriculum last year. This NodeJS scraper is expected to be more performant than the last one.  \n\nclone and install dependencies to get started.  \n* `git clone https://github.com/zeroby0/lms-scraper`  \n* `yarn` or `npm install`\n\nIf `yarn` fails with `Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)`, install with `npm` first and use `yarn` from then on.  \n\n\u003e Note: Make sure you define your username and password in your environment. Either run `export LMS_USERNAME=\"Your Username\"` and `export LMS_PASSWORD=\"Password\"` in every terminal session before you run scraper or add them to your `bash_profile`.\n\n\u003chr\u003e\n\n## Documentation\n\nNote: All settings can be changed by editing `config/default.yml`.\n\n### Supported\n* Login\n* Courses and Private Files from home page\n* List of Forums, Activities (Assignments), and Course Materials and link to, descriptions for them\n* Activity (Assignment) details, submission and feedback recieved.\n* Files uploaded in Course material section\n\n### Limitations\n* Forum content not supported right now.\n\n### Usage\n1. `Require` `index.js` from where you'd like to use the scraper. like so, `const API = require('./index')`.\n2. API.getContent('your-url')\n3. Get back JSON\n4. ??\n5. Profit!\n\nAPI automatically resolves the URL and returns a `Promise` which resolves into JSON.  \nExample:\n``` js\napi.getContent(url)\n   .then((result) =\u003e {\n     console.log(result)\n   })\n```\nJSON responses are defined in `config/default.yml`. Here is the reference:\n### General response\n``` js\n{\n  context: '\u003ccontext\u003e',\n  status: '\u003cstatus\u003e',\n  code: '\u003cerror-code\u003e',\n  data: {\n    data_single: '\u003cdata\u003e',\n    data_multiple: ['\u003cdata\u003e']\n  },\n  error: '\u003cError if any\u003e'\n}\n```\n\n`context`: indicates the content of the response.  \n`status`: indicates the status of the API call. `status` is `success` if everything went well.  \n`code`: The error code. It is preferable to rely on `status` than  `code`.  \n`data`: The data returned by the call.  \n`url`: The url passed in call. Though URL is returned, it's not included in all responses. Errors for example. Do not rely on URL for identifying the response, maintain a record of call and response.   \n\n### Login:\n``` js\n{  // Successful\n    context:'login',\n    status:'authenticated',\n    code:0,\n    data:{  \n        status:'You are logged in as \u003cName and rollnumber\u003e (Log out)',\n        cookies:{  \n            MoodleSession:'*\u0026#%*#\u0026%*\u0026%*#~\u0026$%*\u0026'\n        }\n    }\n}\n```\n``` js\ninavlidCredentials: { context: 'login', status: 'invalidCredentials', code: 1 } // Invalid username or password\ncannotConnect: { context: 'login', status: 'cannotConnect', code: 3 } // Network Unavailable\nunknownError: { context: 'login', status: 'Error', error: '\u003cerror\u003e', code: 4 } // an unexpected error occured\n```\n### Home\n``` js\n{  \n    courseList:{  \n        context:'courseList',\n        status:'success',\n        data:{  \n            links:[Array],\n            names:[Array]\n        },\n        code:0\n    },\n    privateFiles:{  \n        context:'privateFiles',\n        status:'success',\n        data:{  \n            links:[Array],\n            names:[Array]\n        },\n        code:0\n    }\n}\n```\n``` js\ncannotConnect: { context: 'home', status: 'cannotConnect', code: 1 } // Network unreachable\nunknownError: { context: 'home', status: 'error', error: '\u003cError\u003e', code: 2 } // An unexpected error occured\n```\n### Course\n``` js\n{  \n    context:'course',\n    status:'success',\n    url: '\u003ccourse-url\u003e',\n    data:{  \n        forums:{  \n            context:'forumList',\n            status:'success',\n            data:[  \n                Object\n            ],\n            code:0\n        },\n        activities:{  \n            context:'activityList',\n            status:'success',\n            data:[  \n                Object\n            ],\n            code:0\n        },\n        materials:{  \n            context:'materialList',\n            status:'success',\n            data:[  \n                Object\n            ],\n            code:0\n        }\n    },\n    code:0\n}\n```\n``` js\ncannotConnect: { context: 'course', status: 'cannotConnect', code: 1 } // No network\n\nnoForum: { context: 'forumList', status: 'noForum', code: 1 } // No forum for this course\nnoActivity: { context: 'activityList', status: 'noActivity', code: 1 } // No activities for this course\nnoMaterial: { context: 'materialList', status: 'noMaterial', code: 1 } // No materials for this course\n\nunknownError: { context: 'course', status: 'Error', error: '\u003cError\u003e', code: 2 } // An unexpected error occured\n```\n### Materials\n``` js\n{  \n    context:'material',\n    url:'\u003cURL\u003e',\n    status:'success',\n    code:0,\n    data:{  \n        links:[  \n            '\u003cList of links to course materials\u003e'\n        ],\n        names:[  \n            '\u003cList of names in same order\u003e'\n        ]\n    }\n}\n```\n``` js\ncannotConnect: { context: 'material', status: 'cannotConnect', code: 1 } // cannot connect to the internet\nnoContent: { context: 'material', status: 'noContent', code: 2 } // No content in this section\nunknownError: { context: 'material', status: 'Error', error: '\u003cError\u003e', code: 3 } // An unexpected error occured\n```\n\n### Activity\n``` js\n{  \n    context:'activity',\n    url:'\u003cURL\u003e',\n    status:'success',\n    code:0,\n    data:{  \n        intro:{  \n            linkTitles:[Array],\n            links:[Array],\n            lists:[Array],\n            text:'\u003cIntro text\u003e'\n        },\n        feedback:{  \n            left:Array],\n            right:[Array]\n        },\n        submission:{  \n            left:[Array],\n            right:[Array],\n            filesLink:'\u003cLink to subitted file\u003e'\n        }\n    }\n}\n```\n``` js\ncannotConnect: { context: 'activity', status: 'cannotConnect', code: 1} // Network unreachable\nnoContent: { context: 'activity', status: 'noContent', code: 2} // No content in this section\nunknownError: { context: 'activity', status: 'Error', error: '\u003cError\u003e', code: 3 } // An unexpected error occured\n```\n\n### Malformed URL\n``` js\nunknownContext: { context: 'unknown', status: 'unknownContext', url: '\u003cURL\u003e', code: 1 }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroby0%2Flms-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroby0%2Flms-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroby0%2Flms-scraper/lists"}