0

我正在努力从这些表中获取艺术家和曲目名称数据,因为它们是相同的!有谁知道我该怎么做?另一件事是获取 URL 数据,这似乎也没有返回。我已经获得了所有其他领域,只是坚持这些领域,我们很乐意接受任何帮助。(这里的信息<td class="r-pad">:)

      <tr data-trid="**1350474**" class="ptk-1350474 play-trk">
    <td class="tnum-td">
      <div class="tnum-ppl-cont">
        <div class="tnum">1</div>
        <div class="play-fly"><a href="javascript:void(0)" class="com-play" title="Play Track"></a><a href="javascript:void(0)" class="com-pl" title="Cue Track"></a></div>
      </div>
    </td>
    <td class="thumb"><div class="thumb-cont"><img src="http://static.example.com/scripts/image.php/44x44/240148.jpg" /><img src="http://w-static.example.com/img/promo_large.png" class="**promo**" /></div></td>
    <td class="r-pad"><a href="**/track/1350474/track-name**">**TRACK NAME** </a><br /><span class="version">**Original Version** <span class="duration">**(6:40)**</span></span></td>
    <td class="r-pad"><a href="**/artist/17/artist-name**" class="com-artists" data-aid="17">**Artist Name**</a>, **<a href="/artist/14114/artist-name**" class="com-artists" data-aid="14114">**Artist Name 2**</a><br /></td>
    <td class="label-e r-pad"><div class="lab-div ellip"><a href="/label/8831/music-label-name" title="**Music Label Name**">**Music Label<**/a></div></td>
    <td class="genre-e r-pad"><div class="genr-div ellip"><**a href="/genre/13/country-music**" title="Country Music">**Country Music**</a></div></td>
    <td class="rdate r-pad">**2013-11-14**</td>
    <td class="drop">
      <a href="javascript:void(0)" class="com-drop"></a>
      <div class="ttl-drop-menu">
        <div class="com-drop-menu">
          <a href="javascript:void(0)" class="com-close sm"></a>

          <div class="fol-div ellip">follow <a href="javascript:void(0)" data-follow="{aid: 17}" class="follow">test</a></div>

          <div class="fol-div ellip">follow <a href="javascript:void(0)" data-follow="{aid: 14114}" class="follow">test</a></div>

          <div class="fol-div ellip">follow <a href="javascript:void(0)" data-follow="{lid: 8831}" class="follow">test</a></div>

        </div>
      </div>
    </td>
    <td class="buy-stat"><a href="javascript:void(0);" class="com-buy" data-cart="{title_id: 250569, track_id: 1350474, bitrate: 1}" title="Add to Cart"><span class="price">**&#x24;2.99**</span></a></td>
  </tr>
4

1 回答 1

0

您可以通过执行下一个 XPath 来获取轨道名称:

//td[@class='r-pad' and contains(a/@href, 'track')]

要获得两位艺术家的姓名,请执行以下操作:

//td[@class='r-pad']/a[@class='com-artists']

要获得价格,请执行以下操作:

//td[@class='buy-stat'/a[@class='com-buy']/span[@class='price']

要获取轨道 ID,请执行以下操作:

//tr[contains(@class, 'play-trk')]/@data-trid
于 2013-10-31T07:40:00.517 回答