Class GenericProvider
java.lang.Object
io.github.dinethdilhara.urltoproduct.provider.AbstractProductProvider
io.github.dinethdilhara.urltoproduct.provider.impl.GenericProvider
- All Implemented Interfaces:
ProductProvider
Fallback product provider.
This provider attempts to extract product data from any website using:
- JSON-LD structured data (primary source)
- OpenGraph / meta tags (fallback)
- DOM selectors (final fallback)
Used when no specific provider (e.g. Amazon, AliExpress) matches the URL.
- Version:
- 1.0.0
- Author:
- Dineth Dilhara
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOverrides the base extract() to layer JSON-LD extraction first, then fills any missing fields using the standard DOM selectors.protected StringextractDescription(org.jsoup.nodes.Document doc) extractImages(org.jsoup.nodes.Document doc) protected BigDecimalextractPrice(org.jsoup.nodes.Document doc) protected StringextractTitle(org.jsoup.nodes.Document doc) protected booleanmatchesHost(String host) protected StringMethods inherited from class io.github.dinethdilhara.urltoproduct.provider.AbstractProductProvider
connectTo, extractBySelectors, extractImagesBySelectors, extractPriceBySelectors, firstNonBlank, normalizeImageUrl, normalizeWhitespace, parsePrice, supports
-
Constructor Details
-
GenericProvider
public GenericProvider()
-
-
Method Details
-
matchesHost
- Specified by:
matchesHostin classAbstractProductProvider
-
providerName
- Specified by:
providerNamein classAbstractProductProvider
-
extract
Overrides the base extract() to layer JSON-LD extraction first, then fills any missing fields using the standard DOM selectors.- Specified by:
extractin interfaceProductProvider- Overrides:
extractin classAbstractProductProvider- Parameters:
url- product page URL- Returns:
- extracted
ProductDetails
-
extractTitle
- Specified by:
extractTitlein classAbstractProductProvider
-
extractDescription
- Specified by:
extractDescriptionin classAbstractProductProvider
-
extractPrice
- Specified by:
extractPricein classAbstractProductProvider
-
extractImages
- Specified by:
extractImagesin classAbstractProductProvider
-