public static void main(String[] args) throws IOException {
for (int i=21;i<30;i++){
path="https://www.super.kg/media/audio/"+i;
Document dc = Jsoup.connect(path).timeout(6000).get();
Elements body = dc.select("div.clear");
for (Element item : body) {
String method = item.select("div.media_mtspan.video_desc_text").html();
method= method.replaceAll("<br>", "\n");
System.out.println(method);
PrintWriter writer = new PrintWriter("C:\\Users\\cholp\\Desktop\\out.txt", "UTF-8");
writer.println(method);
writer.close();
}
}
}
help me please, cant write variable "method" to file. after running the programm there is nothing in file
div.clearbecause.clearis very likely a class to style the layout and may select lots of unwanted elements, in your case I would recommend using selector such asdiv.media_mt, which is meaningful in the particular music website.