在java中使用多个IP进行抓取
基本上我有一个抓取应用程序。 它每分钟抓取大约 n 个项目。 目前我只有一个IP。
我正在抓取的网站允许每个 IP 有 3 个连接。
我正在考虑获得另一个IP。
这样我就可以获得 6 个连接。
理论上我应该能够在 40 秒内获得 n 件物品,或多或少。
目前我正在使用 java (commons-httpcore) 来完成工作。
我不确定这是java问题还是操作系统问题。
我的机器有IP 1和IP 2 我如何连接到 www.microsoft.com, 使用IP 1 和使用IP2? 我如何指定我想使用哪个 IP 进行连接?
Well basically I have a scraping application.
It scrapes around n items per minute.
currently i have only one IP.
The site i'm scraping allows me 3 connections per IP.
I'm thinking about getting another IP.
so i'll be able to get 6 connections.
in theory i should be able to get n items in 40 seconds, more or less.
currently i'm using java (commons-httpcore) to get the job done.
I'm not sure if this is java question or an OS question.
my machine has IP 1 and IP 2
how do i connect to, say, www.microsoft.com,
using IP 1 and using IP2?
how can i specify, which ip i want to use to do a connection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅: http://hc.apache.org/httpcomponents-client/ httpclient/apidocs/index.html
See: http://hc.apache.org/httpcomponents-client/httpclient/apidocs/index.html