You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+197-3Lines changed: 197 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,204 @@ If `yarn` fails with `Failed to execute 'node-gyp clean' (Error: spawn node-gyp
18
18
19
19
> 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`.
20
20
21
+
<hr>
22
+
21
23
## Documentation
22
24
23
-
All source is under `src` directory. Behaviour is expected to change as the project matures.
25
+
Note: All settings can be changed by editing `config/default.yml`.
26
+
27
+
### Supported
28
+
* Login
29
+
* Courses and Private Files from home page
30
+
* List of Forums, Activities (Assignments), and Course Materials and link to, descriptions for them
31
+
* Activity (Assignment) details, submission and feedback recieved.
32
+
* Files uploaded in Course material section
33
+
34
+
### Limitations
35
+
* Forum content not supported right now.
36
+
37
+
### Usage
38
+
1.`Require``index.js` from where you'd like to use the scraper. like so, `const API = require('./index')`.
39
+
2. API.getContent('your-url')
40
+
3. Get back JSON
41
+
4. ??
42
+
5. Profit!
43
+
44
+
API automatically resolves the URL and returns a `Promise` which resolves into JSON.
45
+
Example:
46
+
```js
47
+
api.getContent(url)
48
+
.then((result) => {
49
+
console.log(result)
50
+
})
51
+
```
52
+
JSON responses are defined in `config/default.yml`. Here is the reference:
53
+
### General response
54
+
```js
55
+
{
56
+
context:'<context>',
57
+
status:'<status>',
58
+
code:'<error-code>',
59
+
data: {
60
+
data_single:'<data>',
61
+
data_multiple: ['<data>']
62
+
},
63
+
error:'<Error if any>'
64
+
}
65
+
```
66
+
67
+
`context`: indicates the content of the response.
68
+
`status`: indicates the status of the API call. `status` is `success` if everything went well.
69
+
`code`: The error code. It is preferable to rely on `status` than `code`.
70
+
`data`: The data returned by the call.
71
+
`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.
72
+
73
+
### Login:
74
+
```js
75
+
{ // Successful
76
+
context:'login',
77
+
status:'authenticated',
78
+
code:0,
79
+
data:{
80
+
status:'You are logged in as <Name and rollnumber> (Log out)',
0 commit comments