Class UrlToProduct
java.lang.Object
io.github.dinethdilhara.urltoproduct.core.UrlToProduct
UrlToProduct
A simple and extensible Java library for extracting structured product data from e-commerce URLs.
This class is the main entry point of the library. It automatically selects the best available provider (Amazon, AliExpress, Generic fallback, etc.) and returns normalized product data.
Example usage:
UrlToProduct extractor = new UrlToProduct();
ProductDetails product = extractor.extract("https://example.com/product/123");
- Version:
- 1.0.0
- Author:
- Dineth Dilhara
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExtracts product information from the given URL.
-
Constructor Details
-
UrlToProduct
public UrlToProduct()Creates a new UrlToProduct extractor instance.Internally loads all available product providers.
-
-
Method Details
-
extract
Extracts product information from the given URL.This method performs the following steps:
- Selects the best matching provider
- Extracts raw product data
- Evaluates confidence and status
- Returns normalized product result
- Parameters:
url- product page URL (must be publicly accessible)- Returns:
- extracted product details with confidence confidenceScore and status
- Throws:
UrlToProductException- if extraction fails or URL is invalid
-