This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
streakers.js
76 lines (66 loc) · 1.51 KB
/
streakers.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
'use strict'
// core
const fs = require('fs')
// npm
require('dotenv-safe').config()
const got = require('got')
const cookie = require('cookie')
const headers = { headers: { cookie: cookie.serialize('sid', process.env.SID) } }
const doit = false
const getDay = (day) => {
// check if file exists (skip if so)
const fn = `${day.replace(/\//g, '-')}.html`
const u = `https://streaker.rollodeqc.com/day/${day}/0`
fs.access(fn, fs.W_OK, (err) => err && got.stream(u, headers).pipe(fs.createWriteStream(fn)))
}
const getMonth = (month) => {
let r
for (r = 1; r < 10; ++r) {
getDay(`${month}/0${r}`)
}
for (r = 0; r < 10; ++r) {
getDay(`${month}/1${r}`)
getDay(`${month}/2${r}`)
}
getDay(`${month}/30`)
}
const getFeb = (year) => {
let r
for (r = 1; r < 10; ++r) {
getDay(`${year}/02/0${r}`)
}
for (r = 0; r < 10; ++r) {
getDay(`${year}/02/1${r}`)
}
for (r = 0; r < 9; ++r) {
getDay(`${year}/02/2${r}`)
}
}
const get31st = (year, part) => {
getDay(`${year}/07/31`)
getDay(`${year}/08/31`)
if (part) {
getDay(`${year}/10/31`)
getDay(`${year}/12/31`)
} else {
getDay(`${year}/01/31`)
getDay(`${year}/03/31`)
getDay(`${year}/05/31`)
}
}
if (doit) {
getDay('2016/09/01')
getDay('2016/09/02')
getDay('2016/09/03')
getDay('2016/09/04')
getDay('2016/09/05')
get31st('2015', true)
get31st('2016')
getFeb('2016')
getMonth('2016/03')
getMonth('2016/04')
getMonth('2016/05')
getMonth('2016/06')
getMonth('2016/07')
getMonth('2016/08')
}