Package ru.snake.amazonwatcher.parser

Source Code of ru.snake.amazonwatcher.parser.ShoptoParser

package ru.snake.amazonwatcher.parser;

import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import ru.snake.amazonwatcher.model.PriceInfo;

public class ShoptoParser extends AbstractParser {

  protected static final String PRICE_CURR = "EUR";

  public ShoptoParser() {
  }

  @Override
  protected String parseDocument(Document document) {
    Element element = document.select("div.our-price").first();
    Element currency = document.select("div.our-price > meta").first();

    if (currency != null) {
      price = new PriceInfo(currency.attr("content"));
    }

    if (element != null) {
      return element.text().trim();
    }

    return null;
  }

}
TOP

Related Classes of ru.snake.amazonwatcher.parser.ShoptoParser

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.