Get meta tag value with Jsoup

hsadik :

I need to get one value from all meta tags:

Elements elements= document.getElementsByTag("meta");

I will get these elements:

<meta name="twitter:image" content="https://lh3.googleusercontent.com/0daLqxVdiOGXvHI1R5aUFf_6znVlBHMturM9SXnpOQagADdYJDycyPzT-btcntR4jW4=w600-h300-pc0xffffff-pd">
<meta name="appstore:developer_url" content="http://www.verylittlenightmares.com">
<meta name="appstore:bundle_id" content="eu.bandainamcoent.verylittlenightmares">
<meta name="appstore:store_id" content="eu.bandainamcoent.verylittlenightmares">
<meta itemprop="price" content="200,00&nbsp;$">
<meta itemprop="url" content="https://play.google.com/store/apps/details?id=eu.bandainamcoent.verylittlenightmares&amp;rdid=eu.bandainamcoent.verylittlenightmares&amp;feature=md&amp;offerId">

How can i get value (200,00 $) from this attribute?

<meta itemprop="price" content="200,00&nbsp;$">
majuran :
private String getPrice(Document document) {

    Elements elements= document.getElementsByTag("meta");

    for (Element metaTag : elements) {
        String content = metaTag.attr("content");
        String itemprop = metaTag.attr("itemprop");

        if ("price".equals(itemprop)) {
            return content;
        }
    }
    return null;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=363653&siteId=1