如何提高Jsoup的解析速度?

时间:2019-05-04 17:10:08

标签: android parsing jsoup

我有一个解析器Jsoup,但是它的速度非常快。我认为解析时间 1.00-ish分钟。如果您能帮助我,我会谢谢您。我想将速度提高到3秒。

  Document documents = Jsoup.connect("http://vuzopedia.ru/vuzfilter?vuz=&price%5B%5D=0&price%5B%5D=1000000"
                + "&mat="
                + Maths + "&rus="
                + Russian + "&fiz=" + Physics + "&obshe="
                + Studies + "&ist=" + History + "&biol=" + Biology + "&inform="
                + Informatics + "&him=" + Chemistry + "&liter=" + Literature + "&georg=" + Geography
                + "&inyaz=" + English
        ).get();
        pagination = documents.select(".pagination li");
        int i = 0, page = 1;
        while(i < Integer.valueOf(pagination.las().text()))
        {
            Document document = Jsoup.connect("http://vuzopedia.ru/vuzfilter?vuz=&price%5B%5D=0&price%5B%5D=1000000"
                    + "&mat="
                    + Maths + "&rus="
                    + Russian + "&fiz=" + Physics + "&obshe="
                    + Studies + "&ist=" + History + "&biol=" + Biology + "&inform="
                    + Informatics + "&him=" + Chemistry + "&liter=" + Literature + "&georg=" + Geography
                    + "&inyaz=" + English + "&page=" + String.valueOf(page)
            ).get();
            vuz.add(document.select(".itemVuzTitle"));
            countOfUniversityAtPages = document.select(".col-md-12.itemVuz");

            for (int t = 0; t < countOfUniversityAtPages.size(); t++)
            {
                NameOfUniversities = vuz.get(i).get(t).text();
                doc = Jsoup.connect(urlF + NameOfUniversities).get();
                webSites = doc.select(".r a[href]");
                UrlOfUniversities = webSites.attr("href");
                Log.e("GG", NameOfUniversities);
                items.add(new Items(NameOfUniversities, UrlOfUniversities));
            }
            i++;
            page++;
        }

0 个答案:

没有答案