I do idhttp1.get for extracting google API results for : http://ajax.googleapis.com/ajax/service ... arge&q=max
I need to extract url's from it so I use:
- Code: Select all
function ExtractText(const Str: string; const Delim1, Delim2: string): string;
var
pos1, pos2: integer;
begin
result := '';
pos1 := Pos(Delim1, Str);
if pos1 > 0 then begin
pos2 := PosEx(Delim2, Str, pos1+1);
if pos2 > 0 then
result := Copy(Str, pos1 + 1, pos2 - pos1 - 1);
end;
end;
So to extract url :
- Code: Select all
memo1.lines.Add((extracttext('"unescapedUrl":"http://www.turkishculturalfoundation.org/pages.php?ID\u003d31","url":"http://www.turkishculturalfoundation.org/pages.php%3FID%3D31","visibleUrl":"www.turkishculturalfoundation.org"','"url":"','","visibleUrl"')))
As you can see I set it to take everything from
- Code: Select all
"url":"
- Code: Select all
","visibleUrl"
- Code: Select all
url":"http://www.turkishculturalfoundation.org/pages.php%3FID%3D31
Why url":" isn't cut ?
How can I go through entire memo1 to extract all links , and when I get to the end to show message 'No more links'.
I'm trying to figure this out , but help would be appreciated. Thanks....