使用 Jquery 从页面中提取数据?

发布于 2024-08-24 19:23:33 字数 597 浏览 5 评论 0原文

我想提取动态网页上的所有 ISBN,但我无法通过 Yahoo Pipe 提供该网页(用户必须登录才能查看该页面)。有没有办法用 jQuery 做到这一点?如何?

编辑: 结构:

以下是该页面上 HTML 的示例。有一个 ,其中包含一系列 元素。其中一个示例大致如下:

<tr> 
  <td>(required/optional)</td>
  <td>LAFORE</td>
  <td>OBJECT ORIENTED PROGRAMMING IN C++ 4E</td>
  <td>9780672323089</td>
  <td>(course and section)</td>
  <td>(pricing information)</td>
</tr> 

其中任何一个都没有 id 属性,但结构定义良好。

谢谢!

I'd like to extract all the ISBNs on a dynamic web page that I can't feed through a Yahoo Pipe (the user has to log in to see the page). Is there a way to do that with jQuery? How?

Edit:
The structure:

Here's an example of what the HTML looks like on that page. There's a <table> that has a series of <tr> elements in them. A sample one of those looks roughly like this:

<tr> 
  <td>(required/optional)</td>
  <td>LAFORE</td>
  <td>OBJECT ORIENTED PROGRAMMING IN C++ 4E</td>
  <td>9780672323089</td>
  <td>(course and section)</td>
  <td>(pricing information)</td>
</tr> 

There are no id attributes on any of these, the structure is well defined though.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亣腦蒛氧 2024-08-31 19:23:33
//ideally provide better table selector if multiple tables are there
var isbns = $.makeArray($("table tr td:nth-child(4)"));
for(var i in isbns) {
  isbns[i] = isbns[i].innerHTML;
  alert(isbns[i]);
}
//now isbns is an array which contains all isbns found in the table
//ideally provide better table selector if multiple tables are there
var isbns = $.makeArray($("table tr td:nth-child(4)"));
for(var i in isbns) {
  isbns[i] = isbns[i].innerHTML;
  alert(isbns[i]);
}
//now isbns is an array which contains all isbns found in the table
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文