14 Jsoup解析文件

时间:2023-1-17    作者:老大夫    分类: 传智JAVA爬虫学习笔记


Test测试类文件

@Test
    public void testFile()throws Exception{
        //解析文件
        Document doc = Jsoup.parse(new File("C:\\Users\\16259\\Desktop\\test.html"),"utf8");

        String title = doc.getElementsByTag("title").first().text();

        System.out.println(title);
    }


扫描二维码,在手机上阅读

推荐阅读: