Colleagues, good evening.

I'm trying to fix the weather site with jsoup.

Actually, I want to drag off the weather values ​​(temperature, wind force, etc.).

private static String url = "http://www.realmeteo.ru/moscow/1/current"; //Метод, парсящий страницу с погодой private static Document getPage() throws IOException { Document page = Jsoup.parse(new URL(url),3000); return page; } //Достаем с сайта нужную нам информацию private static Elements getInfFromPagePrivate () throws IOException { Document page = getPage(); Element getInformation = page.select("table[id=realdata]").first(); Elements getMeteoData = getInformation.select("td[class=meteodata]"); Elements getMeteoData_small = getInformation.select("td[class=meteodata_small]"); return что-то; } 

I can not understand how to pull out all info. The "perceived temperature" block is in meteodata_small, and the rest of the infa is in meteodata.

Question: how can I either pull out all the necessary info into a single object of the Elements type, or how to combine them? I beg you to tell me myself something in any way ..

    1 answer 1

    Well, to say, to sit and do something at night is an idea so-so. He fished himself, in one Elements. As it turned out, you can specify the desired data separated by commas. However, if someone tells me how to connect 2 Elements into one, I will be glad - it will suddenly come in handy.

     Elements getMeteoData = getInformation.select("td[class=meteodata],td[class=meteodata_small]"); 
    • And what does it mean to combine "into one object of type Elements"? Elements is a List<Element> object, if I remember correctly. Accordingly, your result is already in the same list. - Dmitriy