-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
52 lines (45 loc) · 1.52 KB
/
main.js
File metadata and controls
52 lines (45 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import Indexer from './lib/indexer';
require('babel-core/register');
require('babel-polyfill');
// usecase if starting from new.
const indexer = new Indexer();
indexer.login()
.then(() => indexer.startIndex())
.then(() => indexer.writeJsonObj())
.then(() => indexer.writeDownloads())
.catch((err) => {
console.log(err);
indexer.end();
});
// usecase if already have json file indexing all lessons, sub lessons & download links
// (generated & saved as lessons.json when other usecase has been run)
//------------------------------------------------------------------------------------
// const fs = require('fs');
//
// const obj = JSON.parse(fs.readFileSync('lessons.json', 'utf8'));
// const indexer = new Indexer({ lessons: obj, resume: false });
//
// indexer.login()
// .then(() => indexer.writeDownloads())
// .then(() => indexer.end())
// .catch((err) => {
// console.log(err);
// indexer.end();
// });
// usecase if you have already started writing the downloads and had to stop for one reason
// or another
// (generated & saved as lessons.json when other usecase has been run)
//------------------------------------------------------------------------------------
//
// const fs = require('fs');
//
// const obj = JSON.parse(fs.readFileSync('lessons.json', 'utf8'));
// const indexer = new Indexer({ lessons: obj, resume: true });
//
// indexer.login()
// .then(() => indexer.writeDownloads())
// .then(() => indexer.end())
// .catch((err) => {
// console.log(err);
// indexer.end();
// });