-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathscrape.js
65 lines (56 loc) · 1.14 KB
/
scrape.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
var tmi = require("tmi.js")
var fs = require('fs');
var options = {
options: {
debug: false
},
connection: {
reconnect: true
},
identity: {
username: "USERNAME",
password: "oauth:OAUTHKEY"
},
channels: ["nalcs2",
"tsm_dyrus",
"flosd",
"trick2g",
"valkrin",
"sjow",
"hotform",
"nl_kripp",
"scarra",
"wingsofdeath",
"tsm_theoddone",
"trumpsc",
"nvidia",
"c9sneaky",
"itshafu",
"frodan",
"firebat",
"iwilldominate",
"meteos",
"anniebot",
"imaqtpie",
"aphromoo",
"riotgames"]
};
var client = new tmi.client(options);
client.connect();
var counter = 0;
var jsonfile = require('jsonfile')
var file = 'data.json'
var totalstring = ""
client.on("chat", function (channel, userstate, message, self) {
// Don't listen to my own messages..
if (self) return;
message = message.replace(/[^\w\s]/gi, '')
message = message + "<eos>"
totalstring += message
console.log(message);
counter++;
if(counter % 200 == 0)
{
fs.writeFile("database.txt", totalstring, function(err) {});
}
});