0
我想從這個Webpage.中提取足球裝置現在我已經有了從該網頁的表中提取裝置的代碼。使用Jsoup提取特定的表數據
private class LoadFixtures extends AsyncTask<Void,Void,Void> {
String stringDT="",stringHome="",stringAway="";
String url = "http://www.bbc.com/sport/football/spanish-la-liga/fixtures";
String stringTime="";
@Override
protected Void doInBackground(Void... params) {
Document doc = null;
try {
doc = Jsoup.connect(url).timeout(0).get();
Elements matchDetails = doc.select("td.match-details");
Elements ele_hTeam = matchDetails.select("span.team-home.teams");
Elements ele_aTeam = doc.select("span.team-away.teams");
Elements ele_time = doc.select("td.kickoff");
int tsize = ele_hTeam.size();
for(int i=0;i<tsize;i++) {
stringTime+="\n\n"+ele_time.get(i).text();
stringHome+="\n\n"+ele_hTeam.get(i).text();
stringAway+="\n\n"+ele_aTeam.get(i).text();
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
homeTeam.setText(stringHome);
awayTeam.setText(stringAway);
timeView.setText(stringTime);
super.onPostExecute(aVoid);
}
}
這段代碼給了我燈具的整個列表,但我想要做的只是提取特定日期的燈具。例如,可以說我想僅從提取裝置2016年1月16日星期六