For fun I wrote a quick Java script that parses a twitch chat log file and searches for all instances of a given word or phrase.
The code is below...
package twitchchatparser;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author dduncombe
*/
public class TwitchChatParser {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
// Enter filepath here
File file = new File("C:\\Users\\dduncombe\\Documents\\XXXXXXXXX\\SGDQ2016_Twitch_Chatlog");
BufferedReader reader = null;
int i = 0;
try {
reader = new BufferedReader(new FileReader(file));
String text = null;
while ((text = reader.readLine()) != null) {
// Enter search here
String searchString = "fraud";
if (text.contains(searchString)) {
System.out.println(searchString + " No. " + i);
list.add(text);
i++;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
}
}
// print the list
for(String item : list){
System.out.println(item);
}
}
}