【问题标题】:Get Prices from html page从 html 页面获取价格
【发布时间】:2016-02-20 18:50:41
【问题描述】:

您好,我想了解如何从此处的示例http://www.ebay.com/sch/i.html?_sacat=0&_nkw=iphone+5&_frs=1 获取特定于所有价格的值 并返回值,以便我可以说将它们与产品名称一起添加到数据库中。

String weburl = "http://www.ebay.com/sch/i.html?_sacat=0&_nkw=iphone+5&_frs=1";
            URL oracle = new URL(weburl);
            BufferedReader in = new BufferedReader(
            new InputStreamReader(oracle.openStream()));

            String line;
            while ((line = in.readLine()) != null)
            {
                if (line.contains("EUR</b>"))
                {
                    String command = line.split("EUR</b>").toString();
                    final String value = command.substring(8);
                    final StringTokenizer s = new StringTokenizer(value, " ");
                    final String DurationString = s.nextToken();                

                    System.out.println("Timh: " + DurationString);
                }
            }
            in.close();

到目前为止,这对我不起作用。 应该怎么改?

【问题讨论】:

    标签: java html


    【解决方案1】:

    您可以为此使用jSoup。

    请注意,eBay 提供了适合您用途的各种 API。

    https://go.developer.ebay.com/

    【讨论】:

    • 这和我问的有什么关系:P?我只想将网站上的水蛭价格:P 放入一个数组中
    • 哦,我以某种方式得到了它,但很奇怪..我想用令牌 e.t.c 来做
    猜你喜欢
    • 2011-08-03
    • 2011-09-11
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 2012-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多