Package com.jalios.util.webpage
Class WebPageMetaDataExtractorUtils
java.lang.Object
com.jalios.util.webpage.WebPageMetaDataExtractorUtils
Utils to extract a webpage metadata (Title, description, images...)
- Since:
- jcms-9.0.4 && jcms-10
- Author:
- Kevin Bransard
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringextractContent(org.jsoup.nodes.Document document, String attrName, String... cssQueries) Returns the extracted content for given cssQueries and given attribute namestatic WebPageMetaDatagetWebPageMetaData(String url, String userAgent) Returns metadata asWebPageMetaDataobject by connecting to given urlstatic WebPageMetaDataReturns metadata asWebPageMetaDataobject by traversing given html source
-
Method Details
-
getWebPageMetaDataFromHtml
Returns metadata asWebPageMetaDataobject by traversing given html source- Parameters:
html- the html to get meta data from- Returns:
- a
WebPageMetaDataobject - Since:
- jcms-9.0.4
-
getWebPageMetaData
Returns metadata asWebPageMetaDataobject by connecting to given url- Parameters:
url- the url to get meta data fromuserAgent- the user agent to access url (a default user-agent will be used if null)- Returns:
- a
WebPageMetaDataobject - Since:
- jcms-9.0.4
-
extractContent
public static String extractContent(org.jsoup.nodes.Document document, String attrName, String... cssQueries) Returns the extracted content for given cssQueries and given attribute name- Parameters:
document- theDocumentattrName- the attribute name to search for elements returned by the css queries (Can be empty)cssQueries- the css queries performed to search for elements- Returns:
- a value based on cssQueries and attribute name
-