如何使用 Google 群组讨论抓取工具

发布于 2024-08-20 15:11:21 字数 624 浏览 15 评论 0 原文

作为 RSS 中的一个练习,我希望能够搜索该组中几乎所有 Unix 讨论。

comp.unix.shell

我了解足够的 Python 和了解基本的 RSS,但我陷入困境......如何获取特定日期之间的所有消息,或者至少是第 N 个最近和第 M 个最近之间的所有消息?

高级描述,欢迎伪代码。

谢谢你!

编辑:

我希望能够返回超过 100 条消息,但不要像一次解析 10 条消息那样抓取,例如使用以下 URL:

http://groups.google.com /group/comp.unix.shell/topics?hl=en&start=2000&sa=N

一定有更好的方法。

as an exercise in RSS I would like to be able to search through pretty much all Unix discussions on this group.

comp.unix.shell

I know enough Python and understand basic RSS, but I am stuck on ... how do I grab all messages between particular dates, or at least all messages between Nth recent and Mth recent?

High level descriptions, pseudo-code is welcome.

Thank you!

EDIT:

I would like to be able to go back more than 100 messages, but do not grabbing like parsing 10 messages at a time such as using this URL:

http://groups.google.com/group/comp.unix.shell/topics?hl=en&start=2000&sa=N

There must be a better way.

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

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

发布评论

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

评论(4

眼眸里的那抹悲凉 2024-08-27 15:11:21

抓取 Google 网上论坛违反了 Google 服务条款,特别是以下短语:

使用任何机器人、蜘蛛、网站搜索/检索应用程序或其他设备来检索或索引服务的任何部分,或出于任何未经授权的目的收集有关用户的信息

您确定要公开宣布您这样做吗?您是否对结果的后果视而不见?

Crawling google groups violates the Google's Terms of Service, specifically the phrase:

use any robot, spider, site search/retrieval application, or other device to retrieve or index any portion of the Service or collect information about users for any unauthorized purpose

Are you sure you want to announce that you're doing that so openly? And are you blind to the consequences of your result?

骄兵必败 2024-08-27 15:11:21

对于 N 最近,似乎您可以传递参数 ?num=50 或 feed url 中的某些内容

例如,来自 comp.unix.shell 组的 50 条新消息

http://groups.google.com/group/comp.unix.shell/feed/ atom_v1_0_msgs.xml?num=50

然后选择一个 feedparser 程序,例如 Universal Feed Parser

feedparser 中的 >.update_parsed 选项,您可以使用它来检查特定日期范围内的消息

>>> e.updated_parsed              # parses all date formats
(2005, 11, 9, 11, 56, 34, 2, 313, 0)

For N recent, seems like you could pass parameter ?num=50 or something in the feed url

For example, 50 new messages from comp.unix.shell group

http://groups.google.com/group/comp.unix.shell/feed/atom_v1_0_msgs.xml?num=50

and then pick up a feedparser program like Universal Feed Parser

There is .update_parsed option in feedparser, you could use that to check the msg within particular date range

>>> e.updated_parsed              # parses all date formats
(2005, 11, 9, 11, 56, 34, 2, 313, 0)
仙女 2024-08-27 15:11:21

正如 Randal 提到的,这违反了 Google 的服务条款——但是,作为假设或在没有这些限制的其他网站上使用,您可以很容易地使用 urllibBeautifulSoup。使用 urllib 打开页面,然后使用 BeautifulSoup 抓取所有线程主题(如果您想爬得更深,还可以使用链接)。然后,您可以通过编程方式找到下一页结果的链接,然后创建另一个 urllib 来转到第 2 页 - 然后重复该过程。

此时您应该拥有所有原始数据,然后只需操作数据并实现搜索功能即可。

As Randal mentioned, this violates Google's ToS -- however, as a hypothetical or for use on another site without these restrictions you could pretty easily rig something up with urllib and BeautifulSoup. Use urllib to open the page and then use BeautifulSoup to grab all the thread topics (and links if you want to crawl deeper). You can then programmatically find the link to the next page of results and then make another urllib to go to page 2 -- then repeat the process.

At this point you should have all the raw data, then it is just a matter of manipulating the data and implementing your searching functionality.

守护在此方 2024-08-27 15:11:21

你考虑过雅虎YQL吗?它还不错,可以访问很多 API。 http://developer.yahoo.com/yql/

我不知道是否支持群组但你可以访问 RSS 提要。可能会有帮助。

Have you thought about yahoos YQL? It's not too bad and can access a lot of APIs. http://developer.yahoo.com/yql/

I don't know if groups is suported but u can access rss feeds. Could be helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文