美文网首页
Android爬虫

Android爬虫

作者: gsn_hear | 来源:发表于2020-05-23 11:44 被阅读0次

    添加依赖:

        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();
    

    相关文章

      网友评论

          本文标题:Android爬虫

          本文链接:https://www.haomeiwen.com/subject/amccahtx.html