【问题标题】:Remove disclaimer and other properties from plain-text Whois从纯文本 Whois 中删除免责声明和其他属性
【发布时间】:2014-12-04 17:40:37
【问题描述】:

我正在使用 ruby​​ whois gem,我想知道是否有一种方法可以在没有免责声明的情况下返回纯文本格式。

这是 .eu 域的示例:

% The WHOIS service offered by EURid and the access to the records
% in the EURid WHOIS database are provided for information purposes
% only. It allows persons to check whether a specific domain name
% is still available or not and to obtain information related to
% the registration records of existing domain names.
%
% EURid cannot, under any circumstances, be held liable in case the
% stored information would prove to be wrong, incomplete or not
% accurate in any sense.
%
% By submitting a query you agree not to use the information made
% available to:
%
% - allow, enable or otherwise support the transmission of unsolicited,
%   commercial advertising or other solicitations whether via email or
%   otherwise;
% - target advertising in any possible way;
%
% - to cause nuisance in any possible way to the registrants by sending
%   (whether by automated, electronic processes capable of enabling
%   high volumes or other possible means) messages to them.
%
% Without prejudice to the above, it is explicitly forbidden to extract,
% copy and/or use or re-utilise in any form and by any means
% (electronically or not) the whole or a quantitatively or qualitatively
% substantial part of the contents of the WHOIS database without prior
% and explicit permission by EURid, nor in any attempt hereof, to apply
% automated, electronic processes to EURid (or its systems).
%
% You agree that any reproduction and/or transmission of data for
% commercial purposes will always be considered as the extraction of a
% substantial part of the content of the WHOIS database.
%
% By submitting the query you agree to abide by this policy and accept
% that EURid can take measures to limit the use of its WHOIS services
% in order to protect the privacy of its registrants or the integrity
% of the database.
%
% The EURid WHOIS service on port 43 (textual whois) never
% discloses any information concerning the registrant.
% Registrant and onsite contact information can be obtained through use of the
% webbased whois service available from the EURid website www.eurid.eu
%
% WHOIS xxxxxx.eu
Domain: xxxxxx.eu

Registrant:
        NOT DISCLOSED!
        Visit www.eurid.eu for webbased whois.

Onsite(s):
        NOT DISCLOSED!
        Visit www.eurid.eu for webbased whois.

Registrar:
        Name: ???
        Website: ???

Name servers:
        ???
        ???
        ???

Please visit www.eurid.eu for more info.

我不认为使用正则表达式是一个好的解决方案,因为每个 whois 服务器都有自己的格式,我还不想使用解析器。提前谢谢你!

【问题讨论】:

  • 如果每个 whois 服务器都返回不同的东西,那么您需要分别对待每个服务器。在这里看起来真的非常简单,因为你只需要用% 来杀死每一行。如果你觉得很有趣,你还可以删除前面没有“配置部分”标题的行,从而也去掉最后一行。或者干脆杀掉最后一行。
  • 我想我几乎会这样做,因为没有更简单的选择。我们开始...

标签: ruby whois-ruby


【解决方案1】:

不,没有内置功能。对于某些解析器,该库可以使用#disclaimer 方法提取免责声明,但随后免责声明已准备好供进一步使用,因此您无法匹配它。

简短的回答,在图书馆的当前状态下这是不可能的。

【讨论】:

  • 很抱歉回答迟了,但我很欣赏这些信息。我想我会考虑对特定域使用 switch/case 语句,然后砍掉不需要的东西。相当丑陋,但我猜这是最简单的方法。干杯。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-23
相关资源
最近更新 更多