Web 服务器块 libwww-perl 请求

Web Server Block libwww-perl requests

我第一次使用网络抓取脚本(Perl 语言)时它运行良好,但在 ~ 3500(GET 请求)服务器之后 return 403 错误(禁止 | 不是 ip 禁止)但是当使用相同的脚本时在(python 语言)我发现同样的问题有效,但在 ~ 3500 个请求后我得到 403(24 小时后重新运行)我不知道问题是什么以及如何解决它

我阅读了有关 libwww-perl 的信息:

https://cloudkul.com/blog/block-libwww-perl-attack-in-apache-web-server/

使用agent method provided by LWP::UserAgent更改“用户代理标识字符串”。

应该解决基于客户端标识字符串的阻塞。
不会解决基于滥用行为的屏蔽问题。

perldoc LWP::UserAgent

agent

  my $agent = $ua->agent;
  $ua->agent('Checkbot/0.4 ');    # append the default to the end
  $ua->agent('Mozilla/5.0');
  $ua->agent("");                 # don't identify

Get/set the product token that is used to identify the user agent on the network. The agent value is sent as the User-Agent header in the requests.

The default is a string of the form libwww-perl/#.###, where #.### is substituted with the version number of this library.

If the provided string ends with space, the default libwww-perl/#.### string is appended to it.

The user agent string should be one or more simple product identifiers with an optional version number separated by the / character.