(Delphi DLL) Fetch robots.txt for a Site
The Chilkat Spider library is robots.txt compliant. It automatically fetches a site's robots.txt file and adheres to it. It will not download pages denied by robots.txt. Pages excluded by robots.txt will not appear in the Spider's "unspidered" list. This example shows how to explicitly download and review the robots.txt for a given site.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Spider;
...
procedure TForm1.Button1Click(Sender: TObject);
var
spider: HCkSpider;
robotsText: PWideChar;
begin
spider := CkSpider_Create();
CkSpider_Initialize(spider,'www.chilkatsoft.com');
robotsText := CkSpider__fetchRobotsText(spider);
Memo1.Lines.Add(robotsText);
CkSpider_Dispose(spider);
end;
|