src/main/java/com/findupon/commons/bot/aircraft/ControllerBot.java
/**
	 * Controller.com detail page parser:
	 *
	 * <ul>
	 * <li>product term, listing id, year, manufacturer, and model is in url</li>
	 * <li>price found by dollar symbol</li>
	 * <li>img found in tag containing alt value equalling YEAR MAKE MODEL at Controller.com</li>
	 * </ul>
	 *
	 * todo - java 8-ify
	 * @param url, e.g. https://www.controller.com/listings/aircraft/for-sale/25257909/2012-learjet-45xr
	 * @return {@link BuiltProduct}
	 */
Controller.com detail page parser:

product term, listing id, year, manufacturer, and model is in url
price found by dollar symbol
img found in tag containing alt value equalling YEAR MAKE MODEL at Controller.com


java 8-ify
@param url, e.g.
Controller . com detail page parser : product term listing id year manufacturer and model is in url price found by dollar symbol img found in tag containing alt value equalling YEAR MAKE MODEL at Controller . com java 8 - ify @param url e . g .
@Override
	public BuiltProduct buildProduct(String url) {
		String listingId = StringUtils.substringBetween(url, "for-sale/", "/");
		Document document = download(url);
		if(document == null) {
			logger.debug(logPre() + "Document came back null from connection agent [{}]", url);
			return BuiltProduct.removed(listingId);
		}
		Aircraft aircraft = new Aircraft(url);
		aircraft.setListingId(listingId);
		String yearVal = StringUtils.substringBetween(url, listingId + "/", "-");
		if(yearVal != null) {
			aircraft.setYear(AttributeOperations.reduceToInteger(yearVal));
		}
		document.select("div.information-box.print-row-2col > div.row")
				.forEach(e -> setAttribute(aircraft, e.text()));
		if(aircraft.getMake() != null) {
			aircraft.setMainImageUrl(getMainImgUrl(document, yearVal + " " + aircraft.getMake()));
		}
		aircraft.setPrice(getPrice(document));
		Elements imgs = document.select("div.mc-item.mc-img.mc-selected > img");
		if(CollectionUtils.isNotEmpty(imgs)) {
			String mainImgUrl = imgs.size() > 1
					? imgs.get(1).attr("data-fullscreen")
					: imgs.get(0).attr("data-src");
			aircraft.setMainImageUrl(mainImgUrl);
		}
		return BuiltProduct.success(aircraft);
	}
@ Override public BuiltProduct buildProduct ( String url ) { String listingId = StringUtils . substringBetween ( url , "for-sale/" , "/" ) ; Document document = download ( url ) ; if ( document == null ) { logger . debug ( logPre ( ) + "Document came back null from connection agent [{}]" , url ) ; return BuiltProduct . removed ( listingId ) ; } Aircraft aircraft = new Aircraft ( url ) ; aircraft . setListingId ( listingId ) ; String yearVal = StringUtils . substringBetween ( url , listingId + "/" , "-" ) ; if ( yearVal != null ) { aircraft . setYear ( AttributeOperations . reduceToInteger ( yearVal ) ) ; } document . select ( "div.information-box.print-row-2col > div.row" ) . forEach ( e -> setAttribute ( aircraft , e . text ( ) ) ) ; if ( aircraft . getMake ( ) != null ) { aircraft . setMainImageUrl ( getMainImgUrl ( document , yearVal + " " + aircraft . getMake ( ) ) ) ; } aircraft . setPrice ( getPrice ( document ) ) ; Elements imgs = document . select ( "div.mc-item.mc-img.mc-selected > img" ) ; if ( CollectionUtils . isNotEmpty ( imgs ) ) { String mainImgUrl = imgs . size ( ) > 1 ? imgs . get ( 1 ) . attr ( "data-fullscreen" ) : imgs . get ( 0 ) . attr ( "data-src" ) ; aircraft . setMainImageUrl ( mainImgUrl ) ; } return BuiltProduct . success ( aircraft ) ; }
Controller.com detail page parser:
 <ul>
 <li>product term, listing id, year, manufacturer, and model is in url</li>
 <li>price found by dollar symbol</li>
 <li>img found in tag containing alt value equalling YEAR MAKE MODEL at Controller.com</li>
 </ul>
Controller . com detail page parser : <ul > <li > product term listing id year manufacturer and model is in url< / li > <li > price found by dollar symbol< / li > <li > img found in tag containing alt value equalling YEAR MAKE MODEL at Controller . com< / li > < / ul >