use of org.loboevolution.info.MetaInfo in project LoboEvolution by LoboEvolution.
the class HtmlContent method getJSList.
/**
* <p>getJSList.</p>
*
* @return a {@link java.util.List} object.
*/
public List<MetaInfo> getJSList() {
final List<MetaInfo> infoList = new ArrayList<>();
final HTMLDocumentImpl doc = (HTMLDocumentImpl) this.document;
final HTMLCollectionImpl nodeList = (HTMLCollectionImpl) doc.getElementsByTagName("script");
if (nodeList == null) {
return null;
}
nodeList.forEach(node -> {
if (node instanceof HTMLElement) {
final HTMLElement element = (HTMLElement) node;
String src = element.getAttribute("src");
if (Strings.isNotBlank(src)) {
if (!Urls.isAbsolute(src)) {
src = doc.getFullURL(src).toString();
}
if (src.startsWith("//")) {
src = "http:" + src;
}
infoList.add(MetaInfo.builder().name(src).build());
}
}
});
return infoList;
}
use of org.loboevolution.info.MetaInfo in project LoboEvolution by LoboEvolution.
the class HtmlContent method getMetaList.
/**
* <p>getMetaList.</p>
*
* @return a {@link java.util.List} object.
*/
public List<MetaInfo> getMetaList() {
final List<MetaInfo> infoList = new ArrayList<>();
final HTMLDocumentImpl doc = (HTMLDocumentImpl) this.document;
final HTMLCollectionImpl nodeList = (HTMLCollectionImpl) doc.getElementsByTagName("meta");
if (nodeList == null) {
return null;
}
nodeList.forEach(node -> {
if (node instanceof HTMLElement) {
final HTMLElement element = (HTMLElement) node;
infoList.add(MetaInfo.builder().name(element.getAttribute("name")).itemprop(element.getAttribute("itemprop")).property(element.getAttribute("property")).httpEqui(element.getAttribute("http-equi")).content(element.getAttribute("content")).description(element.getAttribute("description")).charset(element.getAttribute("charset")).build());
}
});
return infoList;
}
Aggregations