XxKanexX
2006-02-17 10:47:22
Will search for a url/file url with a certain exension (optional) in a source code..
Test the example in there, it will give you the first file it found with that name and that extension. Also a weird one after it :p.. Dam those errors.
Const
Site = 'http://gdamedia2.free.fr/videos/vidz.html';
Extension = 'zip';
FileName = 'btm';
Var
i, e, c, sLength, extra: Integer;
S, Buff, Stat: String;
Begin
Status('Gathering Site Information..');
ClearDebug;
S:= GetPage(Site);
sLength:= Length(S);
Status('Searching Site, 4/4% Left');
Writeln('+Results: ');
if(S = '')then
begin
Writeln('Connection Error..');
Terminatescript;
end;
For I:= 1 to sLength Do
Begin
If(Filename <> '')Then
begin
If(Copy(S, I, length(FileName))=FileName)Then
begin
repeat
I:= I-1;
until(Copy(S, I, 1)='"');
E:= I;
repeat
E:= E+1;
until(Copy(S, E, 1)='"');
for c:= I to E do
Buff:= Buff+Copy(S, C, 1);
if(Extension <> '')then
Begin
if(Pos('.'+Extension, Buff)>0)or
(Pos(Extension+'.', Buff)>0)then
Writeln(' - '+Buff);
End Else
Writeln(' - '+Buff);
Delete(S, I, E);
Buff:= '';
end;
end;
for Extra:= 1 to 4 do
if(sLength/Extra >= I)then
stat:= 'Searching Site, '+Inttostr(Extra)+'/4% Left';
if(not(stat = GetStatus))and(stat <> '')then
Status(stat);
End;
Writeln('+Search Complete..');
End.
Test the example in there, it will give you the first file it found with that name and that extension. Also a weird one after it :p.. Dam those errors.