我正在尝试使用jsoup获得SRC的脚本标签
我有这个代码,它为我提供了数据
Document doc = Jsoup.connect("http://www.example.com").timeout(10000).get();
Elements scripts = doc.select("script");
for (Element script : scripts) {
String type = script.attr("type");
if (type.contentEquals("text/javascript")) {
String scriptData = script.data(); // your text from the script
break;
}
}
,但我想获得页面上的所有脚本SRC,我不需要其中的文本。
我在这里缺少什么
I have this code which is giving me the data
Document doc = Jsoup.connect("http://www.example.com").timeout(10000).get();
Elements scripts = doc.select("script");
for (Element script : scripts) {
String type = script.attr("type");
if (type.contentEquals("text/javascript")) {
String scriptData = script.data(); // your text from the script
break;
}
}
but i want to get the all the <script src of my page, i don't need the text inside it.
what i am missing here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论