Reading HTML from a twitch page


#1

Ok so I am trying to grab the HTML from a twitch page and am having issues as I am getting something completely different from what I;d normally see in the console.

String[] html;

void setup() {
  size(400,400);
  html = loadStrings("https://www.twitch.tv");
  printArray(html);
}

void draw() {
  
}

It is outputting a script object ONLY in the console and not what you would normally see when opening the console in Chrome on the same site, what I want to know is what is how to get the HTML you would normally see in the browser Console not the script object that I get from this method.


#2

I don’t know what you think you’re getting as output, but the Processing console intentionally has a size limitation on how much text it can display at once. What you are seeing is the tail end of the page you asked for, which is part of a script.

You are actually getting the HTML though. Look:

String[] html;

void setup() {
  size(400,400);
  html = loadStrings("https://www.twitch.tv");
  println(html[0].substring(0,300));
  
}

void draw() {
  
}