lundi 4 juillet 2016

How would I obtain only the texts of a webpage that contain necessary keyword using JSoup?

I came up with something like this which didn't work out.

 String pconcat="";
    for(int x=0;x<keyWords.length;x++){
    if(doc.body().text().toLowerCase().contains(keyWords[x].toLowerCase())){
          Elements e=doc.select("body:contains("+keyWords[x]+")");
          for(Element element : e)
            {
            pconcat+=element.text();
            System.out.println("pconcat"+pconcat);
      }     
     }
    }




Aucun commentaire:

Enregistrer un commentaire