Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   Delphi (https://forum.antichat.xyz/showthread.php?t=203535)

masel 12.05.2010 19:41

Delphi
 
как сграбить на сайте vkontakte.ru id страницы?

lamer811 12.05.2010 19:53

Для начала сделай авторизацию и покажи, что у тебя получилось

heretic1990 12.05.2010 22:36

Пример реализации авторизации на сервисе VKontakte.ru с использованием компонента Indy 10

после правильной авторизации должен вывести id страницы и имя
Код:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes,
  Graphics, Controls, Forms, Dialogs, StdCtrls,
  idHTTP, idCookieManager, IdCookie;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  http:TidHttp;
  CooM:TidCookieManager;
  data:TStringList;
  page, id, name:String;
begin
  http:=TIdHTTP.Create(Self);
  data :=TStringList.Create;
  CooM:=TidCookieManager.Create(http);
  http.AllowCookies:=true;
  http.CookieManager:=CooM;
  http.HandleRedirects:=true;

 {****Включить по желанию****}

  //  http.Request.Host:='vkontakte.ru';
  //  http.Request.UserAgent:='Opera/9.51 (Windows NT 5.1; U; ru)';
  //  http.Request.Accept:='text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
  //  http.Request.AcceptLanguage:='ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3';
  //  http.Request.AcceptEncoding:='gzip,deflate';
  //  http.Request.AcceptCharSet:='windows-1251,utf-8;q=0.7,*;q=0.7';
  //  http.Request.Referer:='http://vkontakte.ru/u=1';

  data.Add('u=1');
  data.Add('success_url=');
  data.Add('fail_url=');
  data.Add('try_to_login=1');
  data.Add('email='+Edit1.Text);
  data.Add('pass='+Edit2.Text);
  Page:= http.Post('http://vkontakte.ru/login.php?', data);
  data.Free;
  Coom.Free;
  http.Free;
  name:='';
  name:=copy(page,Pos('<h1> <b>Online</b>',page)+length('<h1> <b>Online</b>'),Pos('<span>',page)-(Pos('<h1> <b>Online</b>',page)+length('<h1> <b>Online</b>')));
  if Pos('<h1> <b>Online</b>',page)<>0 then Label4.Caption:='Name :: '+name;
  id:='';
  if Pos('<input type="hidden" id="mid" value="',page)<>0 then delete(page,1,Pos('<input type="hidden" id="mid" value="',page)-1);
  id:=copy(page,Pos('<input type="hidden" id="mid" value="',page)+length('<input type="hidden" id="mid" value="'),Pos('">',page)-(Pos('<input type="hidden" id="mid" value="',page)+length('<input type="hidden" id="mid" value="')));
  if Pos('<input type="hidden" id="mid" value="',page)<>0 then Label3.Caption:='ID :: '+id;

end;

end.

RedFern.89 12.05.2010 22:38

в топку инди

heretic1990 12.05.2010 22:48

RedFern.89, ваши предложения!

stepashka_ 12.05.2010 23:04

Цитата:

Сообщение от RedFern.89
в топку инди

Для начинающих кодеров в самый раз.

GhostOnline 12.05.2010 23:16

Цитата:

Сообщение от RedFern.89
в топку инди

Throll detected!

ЗЫ Сам на данный момент использую другую либу, но все равно считаю инди хорошой либой для некриворуких

090808 13.05.2010 03:22

function TForm1.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);


var
Domen:string;
begin
Domen :=Form1.Idhttp1.Get('http://vkontakte.ru/settings.php');
Domen:=Pars('<div class="labeled_text" id="page_url">http://vkontakte.ru/',Domen,'</div>');
ShowMessage(Domen);

RedFern.89 13.05.2010 03:55

сам лично исправлял баги в инди и юзал их во многих приложениях, пока не зе*ало. юзайте wininet или сокеты))

M_script_ 13.05.2010 08:43

Цитата:

Сообщение от masel
как сграбить на сайте vkontakte.ru id страницы?

/feed.php
/feed2.php


Время: 00:58