In fact, it is not always so easy to parse, as in the example. I have three applications in the market - these are parsed sites, well, well, it was doc.select that was rolled very rarely. It turned out everywhere something of this kind:
html.getElementsByClass("comment").get(i).getElementsByClass("datacom").get(0).text();
In general, there are very complex queries to the desired item. Try under the debug first to get to one element, if it works, then it will be a cycle for all.
Update
For the sake of interest, I also decided to see how to be with https. In the end, I came out like this.
class HTTPRequest extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("https://www.google.by/search?q=images&biw=1680&bih=913&source=lnms&tbm=isch&sa=X&ved=0CAYQ_AUoAWoVChMIhMivvNX2xwIVBlksCh0JUAbr"); HttpResponse response; try { response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); String result = convertStreamToString(instream); instream.close(); final Document html = Jsoup.parse(result); ArrayList<String> images = PageLoader.getImages(html); } } catch (Exception ignored) { ignored.printStackTrace(); } } catch (Exception ignored) { return null; } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); } public static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); }
"); class HTTPRequest extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("https://www.google.by/search?q=images&biw=1680&bih=913&source=lnms&tbm=isch&sa=X&ved=0CAYQ_AUoAWoVChMIhMivvNX2xwIVBlksCh0JUAbr"); HttpResponse response; try { response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); String result = convertStreamToString(instream); instream.close(); final Document html = Jsoup.parse(result); ArrayList<String> images = PageLoader.getImages(html); } } catch (Exception ignored) { ignored.printStackTrace(); } } catch (Exception ignored) { return null; } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); } public static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); }
Get your pictures way managed. =) html.select("img").attr("src")