-1

次の HTML から、指定された形式でデータを抽出する最良の方法は何ですか。

<table class="item over  spicy_logo item_border" item_id="3464864" id="item_3464864" ua-action="Item" ua-label="Item">
    <tbody>
        <tr itemscope itemtype="http://schema.org/MenuItem">
            <td class="item_img_box" item_id="3464864" title="How is it?">
                <table>
                    <tbody>
                        <tr>
                            <td>
                                <div>
                                    <img id='img3464864' src="/yelp_images/s3-media4.fl.yelpcdn.com/bphoto/1P50jjYUA4ofx5hF85wm5Q/ms.jpg" align="left" class="item_img" border="0" alt="How is it?"/>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
            <td class="item_name ">
                <div>
                    <a class="cpa" href="http://miami-beach.eat24hours.com/carrot-express/26721?item_id=3464864" itemprop="name">Teeka Salad</a>
                    <div class="item_desc" itemprop="description">Kale, sunflower sprouts, quinoa, avocado, grape tomato, alfalfa bean sprouts, carrots and cucumber with a choice of dressing.</div>
                </div>
            </td>
            <td class="item_price">
                <div >$<span itemprop="price">9.95</span></div>
            </td>
        </tr>
    </tbody>
</table>

期待される出力:

ITEM_NAME : ティーカサラダ

ITEM_DESCRIPTION : ケール、ヒマワリの芽、キノア、アボカド、グレープ トマト、アルファルファもやし、ニンジン、キュウリのドレッシング。

ITEM_PRICE: $9.95

ITEM_IMG : /yelp_images/s3-media4.fl.yelpcdn.com/bphoto/1P50jjYUA4ofx5hF85wm5Q/ms.jpg

Jsoup と Jaunt を使用してさまざまな方法を試しました。まだそれを理解することができません。

4

1 に答える 1