我正在努力抓住艺术家并跟踪这些表中的名称数据,因为它们完全相同!有谁知道我怎么做到这一点?另一件事是拿起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">**$2.99**</span></a></td>
</tr>
答案 0 :(得分: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