SRL Archive - Other Scripts

Get All Specific File Extensions.


XxKanexX

2006-07-07 12:55:20

Just say there we 200 zip files on a website, Input the Extension const as ".zip" and the site address in site then press play. It should gather the link to all 200 zip files and display it.

Only another re-write of an old script, no particular purpose unless you're downloading files and don't want to run through the page.


Const Extension = '.zip';
Const Site = 'http://www.greendayauthority.com/download/videos.php';

function Del(w: array of Char; s: String): String;
var i, e: Integer;
begin
Result:= s;
for i:= 1 to Length(s) do
begin
for e:= 0 to GetarrayLength(w)-1 do
begin
if (Copy(Result, i, 1) = w[e]) then Delete(Result, i, 1);
end;
end;
end;

var EPos: array of Integer;
var s, g: String;
var i, e, a: Integer;
begin
SetarrayLength(EPos, 1);
ClearDebug;
Writeln('Recieving Site.');
s:= GetPage(Site);
for i:= 1 to Length(s) do
begin
if (Copy(s, i, Length(Extension)) = Extension) then
begin
EPos[GetarrayLength(Epos)-1]:= i;
SetarrayLength(EPos, GetarrayLength(Epos) + 1);
end;
end;
Writeln('Found: ' + Inttostr(GetarrayLength(EPos)-1));
Writeln(' ');
for i:= 0 to GetarrayLength(EPos)-2 do
begin
a:= 0;
repeat
a:= a + 1;
until(Copy(s, EPos[i]-a, 1) = '"');
g:= Copy(s, EPos[i]-a, a + Length(Extension));
Delete(g, 1, 1);
while (Copy(g, 1, 1) = ' ') do Delete(g, 1, 1);
Writeln(Inttostr(i + 1) + ': "' + Del(['<', '>'], g) + '"');
end;
end.

shaunthasheep

2006-07-07 13:01:13

cool, but i have no idea how u made the script :p

XxKanexX

2006-07-07 13:13:26

I made it recieve the website into a string and everytime it found the file extension it saved the position into an array, it repeated that until it found no more. From there it just searched backwards from the position until it found '"', Thus meaning the begginning of the link. Ect, ect :p