SRL Archive - Research & Development Lounge

GetAndSafeWebText


Dumpin

2007-12-24 07:57:57

Gets text between selected tags from a html page and safes them to your include Map.

Website = the webpage you want to take from
BeginTag is the tag befor the text (<HTML>for example).
Endtag is the tag after the text (</HTML> for example).
NameOfFile is how you wanna call the file that gets safed.

program New;

var
A, P : string;
Text : TStringList;
B, E, L : integer;

{.Script Info:
# ScriptName = Function GetAndSafeWebText(BeginTag, EndTag, NameOfFile:string): boolean;
# Author = Dumpin
# Description = Gets text between selected tags from a html page and safes them to your include Map
# Version =
# Date = 24-12-07
# Comments = Website = the webpage you want to take from
BeginTag is the tag befor the text (<HTML>for example).
Endtag is the tag after the text (</HTML> for example).
NameOfFile is how you wanna call the file that gets safed.
/Script Info}


Function GetAndSafeWebText(WebSite, BeginTag, EndTag, NameOfFile:string): boolean;
begin
repeat
P := GetPage(Website);
A := between(BeginTag, EndTag, P);
Trim(A);
Text := TStringList.Create;
text.add(A);
SaveToFile(Text, AppPath + 'Websafes\'+NameOfFile+'.txt');
Result := true;
until(B = 0);
end;



begin
ClearDebug;
GetAndSafeWebText('http://www.runescape.com/','<title>', '</title>', 'Runescape');
writeln('succesfully safed');
end.

If you got questions, feel free to ask.

Negaal

2007-12-24 19:21:18

Maybe example?

Useful, maybe i'll use something like that, if i should make script with auth

XcanadamanX

2007-12-24 21:02:58

ahem… save ;)

looks good though

TViYH

2007-12-24 21:30:37

program New;

var
A, P : string;
Text : TStringList;
B, E, L : integer;

{.Script Info:
# ScriptName = Function GetAndSafeWebText(BeginTag, EndTag, NameOfFile:string): boolean;
# Author = Dumpin
# Description = Gets text between selected tags from a html page and safes them to your include Map
# Version =
# Date = 24-12-07
# Comments = Website = the webpage you want to take from
BeginTag is the tag befor the text (<HTML>for example).
Endtag is the tag after the text (</HTML> for example).
NameOfFile is how you wanna call the file that gets safed.
/Script Info}


Function GetAndSafeWebText(WebSite, BeginTag, EndTag, NameOfFile:string): boolean;
begin
repeat
P := GetPage(Website);
A := Between(BeginTag, EndTag, P);
Trim(A);
Text := TStringList.Create;
Text.Add(A);
SaveToFile(Text, AppPath + 'Web Savings\'+NameOfFile+'.txt');
Result := true;
until(B = 0);
end;



begin
ClearDebug;
GetAndSafeWebText('http://www.runescape.com/title.ws','currently ', ' people', 'Players');
writeln(A);
writeln('Succesfully Saved!');
end.

Dumpin

2007-12-25 04:08:07

From: Negaal
Maybe example?

Useful, maybe i'll use something like that, if i should make script with auth


Run the script in the state it is at the moment. you will find the title of the Runescape website in scar 3.13/Websafes/Runescape