牛叔叔 的笔记

好好学习

2019-10-20 14:06

一小段Java代码使用Jsoup爬豆瓣电影

牛叔叔

JavaEE

(2087)

(0)

收藏

Document doc = Jsoup.connect("https://movie.douban.com/").get();
Elements elements = doc.getElementsByClass("screening-bd").get(0).select("li");
		
for(Element e:elements) {
	System.out.println(e.select("li.title a").text());
	System.out.println(e.select("li a img").attr("src"));
}


运行结果:


双子杀手

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570906505.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570906505.jpg

双子杀手


沉睡魔咒2

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570105165.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570105165.jpg

沉睡魔咒2






航海王:狂热...

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570039912.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570039912.jpg

航海王:狂热...






我和我的祖国...

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2567998580.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2567998580.jpg

我和我的祖国...






中国机长

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2568261402.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2568261402.jpg

中国机长






犯罪现场

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570879785.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570879785.jpg

犯罪现场






罗小黑战记

https://img9.doubanio.com/view/photo/s_ratio_poster/public/p2568288336.jpg


https://img9.doubanio.com/view/photo/s_ratio_poster/public/p2568288336.jpg

罗小黑战记






你好霸王龙

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2569222954.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2569222954.jpg

你好霸王龙






天作谜案

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2571445582.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2571445582.jpg

天作谜案






攀登者

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2568577681.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2568577681.jpg

攀登者






催眠·裁决

https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2569044398.jpg


https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2569044398.jpg

催眠·裁决






哪吒之魔童降...

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2563780504.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2563780504.jpg

哪吒之魔童降...






雪人奇缘

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2567925521.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2567925521.jpg

雪人奇缘






侠路相逢

https://img9.doubanio.com/view/photo/s_ratio_poster/public/p2570803986.jpg


https://img9.doubanio.com/view/photo/s_ratio_poster/public/p2570803986.jpg

侠路相逢






沉睡魔咒

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2185343341.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2185343341.jpg

沉睡魔咒






为国而歌

https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2569772108.jpg


https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2569772108.jpg

为国而歌






受益人

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2569180905.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2569180905.jpg

受益人






急速逃脱

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2568928751.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2568928751.jpg

急速逃脱






决胜时刻

https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2568497857.jpg


https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2568497857.jpg

决胜时刻






丑娃娃

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570312295.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570312295.jpg

丑娃娃






打过长江去

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2546307854.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2546307854.jpg

打过长江去






开国大典

https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2571440642.jpg


https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2571440642.jpg

开国大典






功夫小镇

https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2569848978.jpg


https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2569848978.jpg

功夫小镇










0条评论

点击登录参与评论