I m succeeding with reading this site using simpleML in processing and getting the first username (which is babesmcphee) but I don t get the second username (which is JohnCMayer) or third, fourth, and so on.
I m not sure that I m doing it right with the Strings
or html.indexOf
, I was thinking of doing a for loop
and putting the usernames in an array
.
我的守则如下:
import simpleML.*;
void setup () {
HTMLRequest req = new HTMLRequest(this,"http://tweetingtoohard.com/top");
req.makeRequest();
}
void netEvent(HTMLRequest answer) {
String html = answer.readRawSource();
String link_filter = "/u/";
int first_link_start = html.indexOf(link_filter);
String link_filter_stop = "</a>";
int first_link_end = html.indexOf(link_filter_stop, first_link_start+3);
String real_link_end_filter = """;
int real_link_end = html.indexOf(real_link_end_filter, first_link_start);
String first_link = html.substring(first_link_start+3,real_link_end);
println(first_link);
}
谢谢!