得到背景图象道路的Jsoup从css [英] Jsoup getting background image path from css
本文介绍了得到背景图象道路的Jsoup从css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找给定网站上的所有图片。
I am looking for all of the images on a given website.
为此,我需要找到css中的图片,例如:
For this purpose i need to find the ones that are within the css for example:
.gk-crop {
background-image: url("../images/style1/g_rss-2.png");
}
现在我的问题是如何通过JSoup获取所有这些网址?
Now my question is how can i get all of these urls with JSoup?
到目前为止,我已尝试过以下方法:
so far ive tried the following:
Document doc = Jsoup.connect(url).get();
Elements imagePath = doc.select("[src]");
imagePath.select("*[style*='background-image']");
但到目前为止没有运气。
but so far no luck.
有谁知道我怎么能实现它?
Does anyone know how i can acheive it?
推荐答案
Jsoup
doesn' t解析css文件。
Jsoup
doesn't parse css files.
查看这个要知道 Jsoup
负责什么。
你需要一个单独的css解析器来提取 url
来自 css
文件。看看这个
You need a separate css parser to extract url
from css
files. Have a look at this
这篇关于得到背景图象道路的Jsoup从css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文