PDA

View Full Version : GetAndSafeWebText



Dumpin
12-24-2007, 12:57 PM
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
12-25-2007, 12:21 AM
Maybe example?

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

XcanadamanX
12-25-2007, 02:02 AM
ahem... save ;)

looks good though

TViYH
12-25-2007, 02:30 AM
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
12-25-2007, 09:08 AM
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