![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Народ ну хелп ми а ?
Как сделать авторизация на яндексе и скопировать уже с авторизованного ака (со страницы яндекс ру) один всего 1 символ? А теперь конкретней. 1 авторизуемся на яндекс ру. 2 Со страницы Яндекс ру находим искомое слово (уже сделал). 3 Парсим и выводи в лейбл (тоже есть). Народ ну вот код парса (ниже) , (на форме Батон,лейбл и TIdHTTP) А как теперь сделать авторизацию? и дальнейший парс ? Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, StdCtrls,ComObj,ExcelXP, ActiveX, Grids, OleServer, Excel2000,
IdMessageClient, IdSMTP;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
IdHTTP1: TIdHTTP;
Button3: TButton;
ExcelApplication1: TExcelApplication;
IdSMTP1: TIdSMTP;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
vExcel: Variant;
end;
var
Form1: TForm1;
i:integer;
implementation
{$R *.dfm}
function Pars(T_, ForS, _T: string): string;
var
a, b: integer;
begin
Result := '';
if (T_ = '') or (ForS = '') or (_T = '') then
Exit;
a := Pos(T_, ForS);
if a = 0 then
Exit
else
a := a + Length(T_);
ForS := Copy(ForS, a, Length(ForS) - a + 1);
b := Pos(_T, ForS);
if b > 0 then
Result := Copy(ForS, 1, b - 1);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Source, Source_forum:TstringList;
Begin
Source:=TStringList.Create;
Source.Text:=IdHTTP1.Get('http://www.yandex.ru/');
label1.caption:=Utf8ToAnsi (WideString(label1.caption));
Source.Text:=Utf8ToAnsi (WideString( Source.Text));
label1.caption:=label1.caption+Pars('<a href="//maps.yandex.ru/traffic" class="b-link_black_novisit">',Source.Text,'</a>');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
vExcel:=CreateOleObject('Excel.Application');
vExcel.Visible:=false;
end;
end.Последний раз редактировалось Admin, 11.04.2015 в 11:05. |
|
#2
|
|||
|
|||
|
Берёшь HTTP сниффер, смотришь им как авторизуется бразуер, повторяешь это в своём коде, Proffit!
|
|
#3
|
||||
|
||||
|
И не забываем подставлять куки и рефереры
|
|
#4
|
||||
|
||||
|
Код:
function TYandexJobThread.Login: String;
var
s: String;
i: Integer;
begin
Result:='';
(* auth *)
s:='';
s:=s+'&from=passport';
s:=s+'&retpath=https://passport.yandex.ru/passport?mode=passport';
s:=s+'&display=page';
s:=s+'&login='+StrToHex(ALogin);
s:=s+'&passwd='+StrToHex(APass);
s:=DoRequestHttps('POST', 'passport.yandex.ru', '/passport?mode=auth&twoweeks=yes', '', s);
i:=Pos('Passport.idkey', s);
if i=0 then raise Exception.Create('!Passport.idkey');
s:=Trim(Copy(s, i+14, Length(s)));
if s[1]<>'=' then raise Exception.Create('!Passport.idkey');
s:=Trim(Copy(s, 2, Length(s)));
i:=Pos(';', s);
if i=0 then raise Exception.Create('!Passport.idkey');
s:=Trim(Copy(s, 1, i-1));
if s<>'''''' then raise Exception.Create('!auth');
end; |