code: private List<Element> extractElements(String content, String selector, int amount) {
  
  		Element body = parseContent(content);
  
  		List<Element> elements = body.select(selector);
  		if (elements.size() > 0) {
  
  			elements = filterParents(elements);
  
  			if (amount >= 0) {
  				// limit to the indicated amount
  				elements = elements.subList(0, Math.min(amount, elements.size()));
  			}
  
  			// remove all from their parents
  			for (Element element : elements) {
  				element.remove();
  			}
  		}
  
  		List<Element> results = new ArrayList<Element>();
  		// first element is the body
  		results.add(body);
  		results.addAll(elements);
  		return results;
  	}
docs: Extracts elements from the HTML content.
  
  @param content
  @param selector
  @param amount
  @return the remainder and a list of extracted elements. The main body (remainder after
  extraction) is always returned as the first element of the list.