Never mind, I managed to get a version of this to work for youtube comments:
import processing.net.*;
int counter = 0;
int minute;
int[] counts = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int[] resetcounts = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
String[] names = {"flip","regeneration","zombie","witch","spider","creeper","skeleton","blindness","levitation","slowness","poison"};
String[] commands = {
"tp @a ~ ~ ~ ~180 ~",
"effect give @a minecraft:regeneration 10 1",
"execute at @a as @a run summon minecraft:zombie",
"execute at @a as @a run summon minecraft:witch",
"execute at @a as @a run summon minecraft:spider",
"execute at @a as @a run summon minecraft:creeper",
"execute at @a as @a run summon minecraft:skeleton",
"effect give @a minecraft:blindness 20 1",
"effect give @a minecraft:levitation 1 10",
"effect give @a minecraft:slowness 20 0",
"effect give @a minecraft:poison 10 0"};
String desiredname;
int desiredid;
String[] temporary;
void setup(){size(10,10);
String[] page = loadStrings("https://www.youtube.com/watch?v=CKuK41VMv0E&lc=all");
minute = minute();
counts = resetcounts;
counter = 0;
for (int i = 0; i < page.length; i++){
for (int x = 0; x < counts.length; x++){
String prefix = "!";
String search = prefix + names[x];
String toBeSearched = page[i];
int index = toBeSearched.indexOf(search);
String search2 = "seconds ago";
if (index>0) index = toBeSearched.indexOf(search2);
if(index>0){counts[x]++;}
}
}
int desiredvalue = max(counts);
if (desiredvalue>0){
for (int x = 0; x < counts.length; x++){
if (counts[x] == desiredvalue){desiredname = names[x];}
if (counts[x] == desiredvalue){desiredid = x;}
}
print(desiredname);
println(" has been chosen to run");
}
if (desiredvalue==0){print("No votes in the past minute.");}
if (desiredvalue>0){temporary = split(commands[desiredid], '#');}
if (desiredvalue>0){saveStrings("/Users/mac/Library/Application Support/minecraft/saves/Datapack test/datapacks/demo/data/demo/functions/init.mcfunction",temporary);}
}
Thanks for trying to help me anyways though