BFont f; String headline = ""; void setup() { size(640,100); getHeadline(); f = loadFont("Meta-Bold.vlw.gz"); } void loop() { background(0); fill(255); textFont(f,48); text(headline,10,58); textFont(f,24); int current = 60 - second(); text("this applet will load cnn's main headline in " + current + " seconds",10,85); if (second() == 0) { getHeadline(); } } void getHeadline() { //Get all the HTML source code into an array of strings (each line is one element in the array) //String url = "http://www.cnn.com"; String url = "loadstrings.php?url=http://www.cnn.com"; String[] lines = loadStrings(url); //convert array into one long string String stuff = makeOneLongString(lines); stuff = deleteUpUntil(stuff,"

"); stuff = deleteUpUntil(stuff,">"); int index = stuff.indexOf("<"); headline = stuff.substring(0,index); } //take a string and delete everything up to and including a search phrase String deleteUpUntil(String stuff, String search) { int index = stuff.indexOf(search); return stuff.substring(index + search.length(),stuff.length()); } String makeOneLongString(String[] input) { //start with an empty string and concatenate all lines together String s = ""; for (int i = 0; i < input.length; i++) { s = s + input[i]; } return s; }