Rectangle 27 0

java JSoup scrape HTML document by attribute value?


Elements pgElem = doc.select("div.thumb").select("div.meta").select("[data-track]");
        Elements ownerElements = new Elements();
        for(Element element:pgElem){
            if(!element.getElementsByAttributeValueContaining("data-track","owner").isEmpty()){
                ownerElements.add(element);
            }
        }
doc.select("div.thumb").select("div.meta").select("[data-track=owner]")

Thanks. Any idea why the documentation says "[attr=value]: elements with attribute value, e.g. [width=500] (also quotable, like sequence")" Is this for non-string attributes? source: jsoup.org/cookbook/extracting-data/selector-syntax

Note