我正在尝试选择包含频道,艺术家,歌曲等的第一行。我不知道如何选择它?
这是网站:
我试过了
$(“td:contains('51')”)但这不起作用。
最终我希望能够选择后面的行。
----这是我想要抓取的html,但是没有真正的唯一标识符,例如类或元素,并且有多个表,行和表数据
<center>This search includes data from 12:00:00 AM 9/30/2013 to 6:05:18 PM 10/6/2013<br>
<table><tbody><tr><td colspan="5"><div id="light" class="white_content"></div></td></tr><tr><td>
</td><td colspan="3">Search results 1 to 50 of 2441 total matches</td><td><a href="search_playlist.php?artist=&title=&channel=51&month=&date=&shour=&sampm=&stz=&ehour=&eampm=&resultcount=2441&page=1">Next<br>Page</a></td></tr><tr><td class="channel">Channel</td><td class="channel">Artist</td><td class="channel">Title</td><td class="channel">Date</td><td class="channel">Time</td></tr>
以下行:(位于顶部和底部html的中间)
<tr><td>51</td><td>Swanky Tunes+Dvbbs+Eitro</td><td><a href="#Swanky+Tunes%2BDvbbs%2BEitroWe+Know" onclick="seeqpodSearch('Swanky+Tunes%2BDvbbs%2BEitro','We+Know')">We Know</a></td><td>10/5/2013</td><td>3:00:05 AM</td></tr>
-
<tr><td>51</td><td>Stefan Biniak</td><td><a href="#Stefan+BiniakJohnny+Rotten+Bootleg" onclick="seeqpodSearch('Stefan+Biniak','Johnny+Rotten+Bootleg')">Johnny Rotten Bootleg</a></td><td>10/5/2013</td><td>2:54:46 AM</td></tr>
<tr><td>51</td><td>Tiesto+Dyro</td><td><a href="#Tiesto%2BDyroParadise" onclick="seeqpodSearch('Tiesto%2BDyro','Paradise')">Paradise</a></td><td>10/5/2013</td><td>2:50:12 AM</td></tr>
<tr><td>51</td><td>@ClubLifeRadio</td><td><a href="#%40ClubLifeRadioTop+40+Countdown" onclick="seeqpodSearch('%40ClubLifeRadio','Top+40+Countdown')">Top 40 Countdown</a></td><td>10/5/2013</td><td>2:49:48 AM</td></tr>
</tbody></table>
答案 0 :(得分:2)
var row = $('td.channel:first-child').parent().next();
将为您提供整行。
修改强>
获取以下行,
While(row.not(':last-child')){
Do stuff.
row = row.next();
}