All- I have the following code:
class AddStringTask extends AsyncTask<Void, String, Void> {
@Override
protected Void doInBackground(Void... unused) {
org.jsoup.nodes.Document doc = null;
try {
doc = Jsoup.connect("http://scores.espn.go.com/
nfl/gamecast?
gameId=320909007',%20'gamecast320909007"
).get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
docTitle = doc.select("head").first().text();
return null;
}
}
I get the output "NFL Gamecast - Chicago vs Green Bay" (Green Bay won by the way). That is great but when I tried to get the actual score I could not figure out how. My problem was I was trying to replace "head" with <div id="awayScoreBox" class="vscorebox">...</div>
(this is under the <Body>
Tag). So following the format of using the "head" tag I tried this:
docTitle = doc.select("div id="awayScoreBox" class="vscorebox"").first().text();
return null;
As you can imagine I got a syntax error but could not figure out why. I realize that I might have to specify that this is under the <Body>
tag but I could not find any information on how to go about doing this. Any help would be greatly appreciated.