【发布时间】:2020-08-25 01:13:16
【问题描述】:
我正在努力获取从我的网站上抓取的图像的绝对路径。我查看了 jsoup.org 上的文档,但我无法让 abs:src 工作。我不知道如何实现 abs:src 或在哪里添加它。
<cfhttp method="get" url="https://theculturecook.com/recipe-slowroasted-pork-belly.html" result="theresult">
<cfscript>
Jsoup = createObject("java", "org.jsoup.Jsoup");
html = "#theresult.filecontent#";
doc = Jsoup.parse(html);
tags = doc.select("img[src$=.jpg]");
</cfscript>
<cfset images = "">
<cfloop index="e" array="#tags#">
<cfoutput>
<cfset images = ListAppend(images,#e.attr("src")#)>
</cfoutput>
</cfloop>
<cfloop list="#images#" index="a">
<cfoutput>#a#<br></cfoutput>
</cfloop>
【问题讨论】:
-
我尝试了该解决方案,但出现错误“函数声明中缺少函数关键字”。
-
导致该错误的代码是什么?
标签: parsing coldfusion jsoup