rendered paste bodyprocedure TForm1.GoogleSearch(Canal, Nick, Palavra: string);
const
Site = 'http://www.google.com.br/search?client=firefox-a&rls=org.mozilla%3Apt-BR%3Aofficial&channel=s&hl=pt-BR&q=';
Comp = '&meta=&btnG=Pesquisa+Google';
Ed: array[1..4]of string = ('<b>','</b>',' ','"');
var
Kw, S, X, Resultados: String;
A, B, i, Count: Integer;
begin
if Palavra = '' then
begin
PrivMsg(Canal, '15Sintaxe:1 !g keywords');
Exit;
end;
Kw := StringReplace(Trim(Palavra), ' ', '+', [rfReplaceAll]);
S := IdHTTP1.Get(Site + Kw + Comp);
Count := 0;
while Pos('class=g><a href="', S) > 0 do
begin
A := Pos('class=g><a href="', S) + Length('class=g><a href="');
B := PosEx('class=l>', S, a) - 2;
if Count < 5 then
begin
X := Trim(Copy(S, A, B - A));
if X <> '' then
if Resultados <> '' then
Resultados := Resultados + ' 7|1 ' + Trim(Copy(S, A, B - A))
else
Resultados := Trim(Copy(S, A, B - A));
Inc(Count);
end;
Delete(S, 1, B + 2);
end;
Resultados := StringReplace(Resultados, '<b>', '', [rfReplaceAll]);
Resultados := StringReplace(Resultados, '</b>', '', [rfReplaceAll]);
// ShowMessage(Palavra + ': ' + Resultados);
Resultados := Trim(Resultados);
if Resultados <> '' then
begin
if Resultados[1] = '1' then Delete(Resultados, 1, 1);
PrivMsgBuff(Canal, Palavra + '7:1 ' + Resultados);
end
else
PrivMsgBuff(Canal, 'Nenhum resultado para 4' + Palavra + '1.' + IfThen(UpperCase(Nick) <> 'JIMMYSKULL', ' Você quiz dizer ' + Nick + ' é um mané ?', ''));
end;
procedure TForm1.Processo(Nick, Processo: String);
var
S: String;
A, B, i: Integer;
begin
S := IdHTTP1.Get('http://linhadefensiva.uol.com.br/processos/index.php?f=contem&q=' + Processo);
if Pos('<th>Processo</th>', S) > 0 then
begin
i := 0;
Delete(S, 1, Pos('</table>', S) + 8);
While Pos('<th>Processo</th>', S) > 0 do
begin
if I < 2 then
begin
B := PosEx('<a href=', S, Pos('<th>Processo</th>', S)) + Length('<a href="');
A := Pos('"bold">', S) + 7;
PrivMsgBuff(Nick, '5Link:1 ' + 'http://linhadefensiva.uol.com.br' + Copy(S, B, A - B - 15));
A := Pos('"bold">', S) + 7;
B := PosEx('</a>', S, A);
PrivMsgBuff(Nick, '7Processo1: ' + Copy(S, A, B - A));
Delete(S, 1, Pos('</tr>', S) + 5);
A := PosEx('>', S, Pos('<a href=', S)) + 1;
B := Pos('</a>', S);
PrivMsgBuff(Nick, '7Nome1: ' + Copy(S, A, B - A));
Delete(S, 1, Pos('</tr>', S) + 5);
A := Pos('<td>', S) + 4;
B := Pos('</td>', S);
PrivMsgBuff(Nick, '7Status1: ' + Copy(S, A, B - A));
Delete(S, 1, Pos('</tr>', S) + 5);
Delete(S, 1, Pos('</tr>', S) + 5);
A := Pos('<td>', S) + 4;
B := Pos('</td>', S);
PrivMsgBuff(Nick, '7Descrição1: ' + Copy(S, A, B - A));
Delete(S, 1, Pos('</table>', S) + 5);
PrivMsgBuff(Nick, '4-----------------------------------------------');
end
else
Delete(S, 1, Pos('</table>', S) + 5);
Inc(i);
end;
PrivMsgBuff(Nick, '4Mais1(15'+IntToStr(i)+'1): http://linhadefensiva.uol.com.br/processos/index.php?f=contem&q=' + Processo);
PrivMsgBuff(Nick, 'EoF');
end
else
PrivMsgBuff(Nick, 'Erro ou nada encontrado.');
end;