【DELPHI查询百度排名主要代码】
if SearchSite=1 then
begin
if PageNo = 0 then
begin
//========================================推广计算
TList := SplitString(str,'fm'':''pp'',''title'':');
for i:=1 to TList.Count - 1 do
begin
Titem := TList;
listbox1.Items.Add(inttostr(i));
end ;
del_listbox;
ttop:=inttostr(listbox1.count);
if strtoint(ttop) <=0 then
begin
ttop:='0';
end;
end;
//========================================推广计算结束
if pos(web,str) > 0 then
begin
List := SplitString(str,'onmousedown="return c');
for i:=0 to List.Count - 1 do
begin
item := List;
if Pos(SearchUrl ,item)<>0 then
begin
t := Pos('''p1'':',item);
Top := Copy(item,t+5,3);
Top := StringReplace(Top, '''','', flag);
Top := StringReplace(Top, ',','', flag);
if top = '0})' then
begin
application.MessageBox('您的站为百度推广站,程序拒绝检查百度推广站的排名!','愤怒提示',64);
AN.Enabled:=TRUE;
exit;
end;
if (PageNo < MaxPage) then
begin
newurl := 'http://www.baidu.com/s?wd='+Key+'&pn=' + IntToStr(PageNo*10);
WebBrowser1.Navigate(newurl);
end;
Application.ProcessMessages;
end;
if (PageNo = MaxPage) and (top='') then
begin
LS := LV.Items.Add;
LS.Caption:=key ;
LS.SubItems.Add('在1-'+inttostr(PageNo)+'页中未查询到结果') ;
LS.SubItems.Add('--') ;
LS.SubItems.Add('--') ;
LA1.Caption := '百度关键字查询完毕,未查询到结果!';
AN.Enabled:=true;
exit;
end;