Android爬虫

2020-05-23  本文已影响0人  gsn_hear

添加依赖:

    compile 'org.jsoup:jsoup:1.13.1'

目标参数:

image.png

调用方法

       new Thread() {
            public void run() {
                Document doc = null;
                try {
                    doc = Jsoup.connect("https://www.aliyun.com/?spm=5176.13203013.fnqwg5agi.2.7c9231f9XNJzKY").get();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                Elements newsHeadlines = doc.select("a.top-list-item.pointer");
                for (Element headline : newsHeadlines) {
                    Log.d("data", "名称:" + headline.text() + "网址:" + headline.absUrl("href"));
                }
            }
        }.start();
上一篇 下一篇

猜你喜欢

热点阅读