@@ -56,6 +56,8 @@ public class JsoupSiteParser implements SiteParser {
56
56
private String priceLocator ;
57
57
private String currencyLocator ;
58
58
private String currencyValue ;
59
+ private String altPriceLocator ;
60
+ private String altCurrencyLocator ;
59
61
60
62
// @todo #975 SiteParserServiceImpl: add unit tests for constructor
61
63
public JsoupSiteParser (SiteParserConfiguration cfg ) {
@@ -71,6 +73,8 @@ public JsoupSiteParser(SiteParserConfiguration cfg) {
71
73
priceLocator = cfg .getPriceLocator ();
72
74
currencyLocator = cfg .getCurrencyLocator ();
73
75
currencyValue = cfg .getCurrencyValue ();
76
+ altPriceLocator = cfg .getAltPriceLocator ();
77
+ altCurrencyLocator = cfg .getAltCurrencyLocator ();
74
78
}
75
79
76
80
/**
@@ -99,6 +103,8 @@ public SeriesInfo parse(String htmlPage) {
99
103
info .setSellerUrl (extractSellerUrl (body ));
100
104
info .setPrice (extractPrice (body ));
101
105
info .setCurrency (extractCurrency (body ));
106
+ info .setAltPrice (extractAltPrice (body ));
107
+ info .setAltCurrency (extractAltCurrency (body ));
102
108
103
109
return info ;
104
110
}
@@ -241,6 +247,26 @@ protected String extractCurrency(Element body) {
241
247
return currencyValue ;
242
248
}
243
249
250
+ protected String extractAltPrice (Element body ) {
251
+ String price = getTextOfTheFirstElement (body , altPriceLocator );
252
+ if (price == null ) {
253
+ return null ;
254
+ }
255
+
256
+ LOG .debug ("Extracted alt price: '{}'" , price );
257
+ return price ;
258
+ }
259
+
260
+ protected String extractAltCurrency (Element body ) {
261
+ String currency = getTextOfTheFirstElement (body , altCurrencyLocator );
262
+ if (currency == null ) {
263
+ return null ;
264
+ }
265
+
266
+ LOG .debug ("Extracted alt currency: '{}'" , currency );
267
+ return currency ;
268
+ }
269
+
244
270
private static Element getFirstElement (Element body , String locator ) {
245
271
if (locator == null ) {
246
272
return null ;
0 commit comments