Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 31.52 KB | None | 0 0
  1. unit BaseSoft;
  2.  
  3. interface
  4.  
  5. uses
  6.   Vcl.ComCtrls, System.Classes, System.Variants, System.SysUtils, Dialogs, Vcl.Forms, System.Types,
  7.   ApiInstagram, Math, SYNCOBJS, RegularExpressions, System.Generics.Collections;
  8.  
  9. type
  10.   TAccount = class;
  11.   TTask = class;
  12.  
  13.   Thread = class(TThread)
  14.   private
  15.     a: TAccount;
  16.     msg: string;
  17.   protected
  18.     procedure Execute; override;
  19.     procedure LikeAdd;
  20.     procedure FollowAdd;
  21.     procedure UnfollowAdd;
  22.     procedure CommentAdd;
  23.     procedure AllAdd;
  24.     procedure WorkAdd;
  25.     procedure httperror(txt: string);
  26.     procedure DebugLog(txt: string);
  27.  
  28.     procedure RandomAction(api: TInstagramAPI; Task: TTask);
  29.     procedure RandomAction2(api: TInstagramAPI; Task: TTask);
  30.   public
  31.     constructor Create(a: TAccount);
  32.   end;
  33.  
  34.   TBasis = (pLike, pFollow, pComment, pSave, pViewStory, pUnfollow);
  35.   TRandom = (pViewLenta, pViewNew, pViewNewUser, pViewPopular);
  36.   TRandomDop = (pLikeD, pFollowD, pCommentD, pSaveD, pViewStoryD);
  37.  
  38.   TAccount = class
  39.   private
  40.     FIndex: integer;
  41.     FFThread: Thread;
  42.     FThreadIndex: integer;
  43.     FItem: TListItem;
  44.     FItems: TStrings;
  45.     FItemIndex: integer;
  46.     FUserAgent: string;
  47.     FDevice_id: string;
  48.     FGuid: string;
  49.     FLogin: string;
  50.     FPass: string;
  51.     FProxy: string;
  52.     FPhoto: string;
  53.     FNewPhoto: string;
  54.     FFollows: string;
  55.     FNewFollows: string;
  56.     FFollowed: string;
  57.     FNewFollowed: string;
  58.     FProces: string;
  59.     FStatus: boolean;
  60.     FId: string;
  61.     FTaskIndex: integer;
  62.     FCookie: string;
  63.     FDonor: string;
  64.     FLog: TStringList;
  65.     function GenId: string;
  66.   public
  67.     property Index: integer read FIndex write FIndex;
  68.     property ItemIndex: integer read FItemIndex write FItemIndex;
  69.     property TaskIndex: integer read FTaskIndex write FTaskIndex;
  70.     property Id: string read FId write FId;
  71.     property FThread: Thread read FFThread write FFThread;
  72.     property ThreadIndex: integer read FThreadIndex write FThreadIndex;
  73.     property Item: TListItem read FItem write FItem;
  74.     property Items: TStrings read FItems write FItems;
  75.     property UserAgent: string read FUserAgent write FUserAgent;
  76.     property Device_id: string read FDevice_id write FDevice_id;
  77.     property Guid: string read FGuid write FGuid;
  78.     property Login: string read FLogin write FLogin;
  79.     property Pass: string read FPass write FPass;
  80.     property Proxy: string read FProxy write FProxy;
  81.     property Photo: string read FPhoto write FPhoto;
  82.     property NewPhoto: string read FNewPhoto write FNewPhoto;
  83.     property Follows: string read FFollows write FFollows;
  84.     property NewFollows: string read FNewFollows write FNewFollows;
  85.     property Followed: string read FFollowed write FFollowed;
  86.     property NewFollowed: string read FNewFollowed write FNewFollowed;
  87.     property Proces: string read FProces write FProces;
  88.     property Status: boolean read FStatus write FStatus;
  89.     property Cookie: string read FCookie write FCookie;
  90.     property Donor: string read FDonor write FDonor;
  91.     property Log: TStringList read FLog write FLog;
  92.  
  93.     constructor Create(Login, Pass, Proxy: string); overload;
  94.     destructor Destroy;
  95.   end;
  96.  
  97.   TTask = class(TAccount)
  98.   private
  99.     // cs: TCriticalSection;
  100.  
  101.     FList: TList<TAccount>;
  102.     FBasis: TList<TBasis>;
  103.     FRandomList: TList<TRandom>;
  104.     FRandomListD: TList<TRandomDop>;
  105.  
  106.     FBlackList: TStringList;
  107.     FBaseList: TStringList;
  108.     FCommentList: TStringList;
  109.  
  110.     FLifeId: TStringList;
  111.     FLifePhoto: TStringList;
  112.  
  113.     FROViewLenta: boolean;
  114.     FROViewNew: boolean;
  115.     FROViewNewUser: boolean;
  116.     FROViewPopular: boolean;
  117.  
  118.     FRLike: boolean;
  119.     FRFollow: boolean;
  120.     FRComment: boolean;
  121.     FRSave: boolean;
  122.     FRViewStory: boolean;
  123.  
  124.     FOLike: boolean;
  125.     FOFollow: boolean;
  126.     FOComment: boolean;
  127.     FOSave: boolean;
  128.     FOViewStory: boolean;
  129.     FOUnfollow: boolean;
  130.     // FDirect: boolean;
  131.  
  132.     FListComment: string;
  133.     FListBase: string;
  134.     FListBlack: string;
  135.     // FListDirect: string;
  136.  
  137.     FMinTimeLike: integer;
  138.     FMaxTimeLike: integer;
  139.     FLimitLike: integer;
  140.  
  141.     FMinTimeFollow: integer;
  142.     FMaxTimeFollow: integer;
  143.     FLimitFollow: integer;
  144.  
  145.     FMinTimeComment: integer;
  146.     FMaxTimeComment: integer;
  147.     FLimitComment: integer;
  148.  
  149.     FMinTimeUnfollow: integer;
  150.     FMaxTimeUnfollow: integer;
  151.     FLimitUnfollow: integer;
  152.  
  153.     FRandomO: integer;
  154.     FRandomD: integer;
  155.  
  156.     FUsesBase: boolean;
  157.     FUsesLife: boolean;
  158.     FLifeBase: boolean;
  159.  
  160.     msg: string;
  161.   public
  162.     function NextUser: string;
  163.     function NextUserLife: string;
  164.  
  165.     property BlackList: TStringList read FBlackList write FBlackList;
  166.     property BaseList: TStringList read FBaseList write FBaseList;
  167.     property CommentList: TStringList read FCommentList write FCommentList;
  168.  
  169.     property LifeId: TStringList read FLifeId write FLifeId;
  170.     property LifePhoto: TStringList read FLifePhoto write FLifePhoto;
  171.  
  172.     property ROViewLenta: boolean read FROViewLenta write FROViewLenta;
  173.     property ROViewNew: boolean read FROViewNew write FROViewNew;
  174.     property ROViewNewUser: boolean read FROViewNewUser write FROViewNewUser;
  175.     property ROViewPopular: boolean read FROViewPopular write FROViewPopular;
  176.  
  177.     property RLike: boolean read FRLike write FRLike;
  178.     property RFollow: boolean read FRFollow write FRFollow;
  179.     property RComment: boolean read FRComment write FRComment;
  180.     property RSave: boolean read FRSave write FRSave;
  181.     property RViewStory: boolean read FRViewStory write FRViewStory;
  182.  
  183.     property OLike: boolean read FOLike write FOLike;
  184.     property OFollow: boolean read FOFollow write FOFollow;
  185.     property OComment: boolean read FOComment write FOComment;
  186.     property OSave: boolean read FOSave write FOSave;
  187.     property OViewStory: boolean read FOViewStory write FOViewStory;
  188.     property OUnfollow: boolean read FOUnfollow write FOUnfollow;
  189.     // FDirect: boolean;
  190.  
  191.     property ListComment: string read FListComment write FListComment;
  192.     property ListBase: string read FListBase write FListBase;
  193.     property ListBlack: string read FListBlack write FListBlack;
  194.     // FListDirect: string;
  195.  
  196.     property MinTimeLike: integer read FMinTimeLike write FMinTimeLike;
  197.     property MaxTimeLike: integer read FMaxTimeLike write FMaxTimeLike;
  198.     property LimitLike: integer read FLimitLike write FLimitLike;
  199.  
  200.     property MinTimeFollow: integer read FMinTimeFollow write FMinTimeFollow;
  201.     property MaxTimeFollow: integer read FMaxTimeFollow write FMaxTimeFollow;
  202.     property LimitFollow: integer read FLimitFollow write FLimitFollow;
  203.  
  204.     property MinTimeComment: integer read FMinTimeComment write FMinTimeComment;
  205.     property MaxTimeComment: integer read FMaxTimeComment write FMaxTimeComment;
  206.     property LimitComment: integer read FLimitComment write FLimitComment;
  207.  
  208.     property MinTimeUnfollow: integer read FMinTimeUnfollow write FMinTimeUnfollow;
  209.     property MaxTimeUnfollow: integer read FMaxTimeUnfollow write FMaxTimeUnfollow;
  210.     property LimitUnfollow: integer read FLimitUnfollow write FLimitUnfollow;
  211.  
  212.     property RandomO: integer read FRandomO write FRandomO;
  213.     property RandomD: integer read FRandomD write FRandomD;
  214.  
  215.     property UsesBase: boolean read FUsesBase write FUsesBase;
  216.     property UsesLife: boolean read FUsesLife write FUsesLife;
  217.     property LifeBase: boolean read FLifeBase write FLifeBase;
  218.  
  219.     property Basis: TList<TBasis> read FBasis write FBasis;
  220.     property RandomList: TList<TRandom> read FRandomList write FRandomList;
  221.     property RandomListD: TList<TRandomDop> read FRandomListD write FRandomListD;
  222.  
  223.     constructor Create(PList: TList<TAccount>); overload;
  224.     destructor Destroy;
  225.  
  226.   end;
  227.  
  228. implementation
  229.  
  230. uses unit1;
  231. { Thread }
  232.  
  233. procedure Thread.AllAdd;
  234. begin
  235.   Form1.sLabel4.Caption := inttostr(strtoint(Form1.sLabel4.Caption) + 1);
  236. end;
  237.  
  238. procedure Thread.CommentAdd;
  239. begin
  240.   AllAdd;
  241.   Form1.sLabel14.Caption := inttostr(strtoint(Form1.sLabel14.Caption) + 1);
  242. end;
  243.  
  244. constructor Thread.Create(a: TAccount);
  245. begin
  246.   self.a := a;
  247.   inherited Create(True);
  248.   FreeOnTerminate := True;
  249.   Priority := tpLower;
  250.   Resume;
  251. end;
  252.  
  253. procedure Thread.DebugLog(txt: string);
  254. begin
  255.   Form1.sMemo1.Lines.Add('[DEBUG] ' + txt);
  256. end;
  257.  
  258. procedure Thread.UnfollowAdd;
  259. begin
  260.   AllAdd;
  261.   Form1.sLabel10.Caption := inttostr(strtoint(Form1.sLabel10.Caption) + 1);
  262. end;
  263.  
  264. procedure Thread.Execute;
  265. var
  266.   Task: TTask;
  267.   api: TInstagramAPI;
  268.   rand: TBasis;
  269.   i, r, All, f, l, c, u: integer;
  270.   SText: TStringList;
  271.   Donor, Login, Id: string;
  272.   Black: boolean;
  273. begin
  274.   for i := 0 to TaskList.Count - 1 do
  275.   begin
  276.     if a.Id = TaskList[i].Id then
  277.     begin
  278.       Task := TaskList[i];
  279.       break;
  280.     end;
  281.   end;
  282.   msg := a.Login + ' начало работы';
  283.   Synchronize(WorkAdd);
  284.   sleep(RandomRange(2, 10) * 1000);
  285.  
  286.   if a.Proxy <> '' then
  287.   begin
  288.     api := TInstagramAPI.Create(a.Login, a.Pass, a.Proxy, a.Guid, a.Device_id, a.UserAgent, ApiInstagram.pHTTPS);
  289.   end
  290.   else
  291.   begin
  292.     api := TInstagramAPI.Create(a.Login, a.Pass, a.Proxy, a.Guid, a.Device_id, a.UserAgent, ApiInstagram.pNull);
  293.   end;
  294.  
  295.   // api.OnDebug := DebugLog;
  296.   if Form1.sCheckBox1.Checked = True then
  297.   begin
  298.     api.OnLog := DebugLog;
  299.   end;
  300.   api.httperror := httperror;
  301.  
  302.   if api.Auth <> False then
  303.   begin
  304.     l := 0;
  305.     f := 0;
  306.     u := 0;
  307.     c := 0;
  308.  
  309.     msg := a.Login + ' авторизовались';
  310.     Synchronize(WorkAdd);
  311.  
  312.     if Task.ListBlack <> '' then
  313.     begin
  314.       Task.FBlackList.Clear;
  315.       Task.FBlackList.LoadFromFile(Task.ListBlack);
  316.     end;
  317.     if Task.ListComment <> '' then
  318.     begin
  319.       Task.FCommentList.Clear;
  320.       Task.FCommentList.LoadFromFile(Task.ListComment);
  321.     end;
  322.     if Task.ListBase <> '' then
  323.     begin
  324.       Task.FBaseList.Clear;
  325.       Task.FBaseList.LoadFromFile(Task.ListBase);
  326.     end;
  327.  
  328.     All := 0;
  329.     repeat
  330.       repeat
  331.         if (Task.LifeBase = True) then
  332.         begin
  333.           case RandomRange(1, 2) of
  334.             1:
  335.               begin
  336.                 repeat
  337.                   Login := Task.NextUser;
  338.                   RandomAction(api, Task);
  339.                 until Login <> '';
  340.               end;
  341.             2:
  342.               begin
  343.                 repeat
  344.                   RandomAction(api, Task);
  345.                   Login := Task.NextUserLife;
  346.                 until Login <> '';
  347.               end;
  348.           end;
  349.  
  350.         end;
  351.  
  352.         if (Task.UsesBase = True) then
  353.         begin
  354.           repeat
  355.             Login := Task.NextUser;
  356.             RandomAction(api, Task);
  357.           until Login <> '';
  358.         end;
  359.  
  360.         if (Task.UsesLife = True) then
  361.         begin
  362.           repeat
  363.             RandomAction(api, Task);
  364.             Login := Task.NextUserLife;
  365.           until Login <> '';
  366.         end;
  367.  
  368.         Black := False;
  369.         if Task.ListBlack <> '' then
  370.         begin
  371.           Task.FBlackList.Sort;
  372.           if Task.FBlackList.IndexOf(Login) <> -1 then
  373.           begin
  374.             Black := True;
  375.           end;
  376.         end;
  377.         if Black = True then
  378.         begin
  379.           msg := a.Login + ' ' + Login + ' в BlackList';
  380.           Synchronize(WorkAdd);
  381.         end;
  382.       until Black <> True;
  383.  
  384.       if Task.Basis.Count <> 0 then
  385.       begin
  386.         api.SearchUser(Login);
  387.         for i := 0 to api.IdListUser.Count - 1 do
  388.         begin
  389.           sleep(500);
  390.           api.UserInfo(api.IdListUser[i]);
  391.           if api.GetUser.username = Login then
  392.             break;
  393.         end;
  394.  
  395.         if (api.GetUser.username <> '') and (api.User.ResultCode = 200) then
  396.         begin
  397.           Randomize;
  398.           rand := Task.Basis[random(Task.Basis.Count)];
  399.           case rand of
  400.             pLike:
  401.               begin
  402.                 if (Task.OLike = True) and (Task.LimitLike >= l) then
  403.                 begin
  404.                   if (api.GetUser.is_private <> True) and (api.GetUser.media_count.ToInteger > 0) then
  405.                   begin
  406.                     if l <= Task.LimitLike then
  407.                     begin
  408.                       api.IdPhotoPars(api.GetUser._uid);
  409.                       if api.Like(api.Photo[0]) then
  410.                       begin
  411.                         msg := a.Login + ' поставили лайк ' + api.GetUser.username;
  412.                         Synchronize(WorkAdd);
  413.                         Synchronize(LikeAdd);
  414.                         inc(l);
  415.                         inc(All);
  416.                         a.Item.SubItems[5] := l.ToString + '/' + Task.LimitLike.ToString + ' ' + f.ToString + '/' +
  417.                           Task.LimitFollow.ToString + ' ' + u.ToString + '/' + Task.LimitUnfollow.ToString + ' ' +
  418.                           c.ToString + '/' + Task.LimitComment.ToString;
  419.                         if Task.ListBlack <> '' then
  420.                         begin
  421.                           Task.FBlackList.Add(api.GetUser.username);
  422.                           Task.FBlackList.SaveToFile(Task.ListBlack);
  423.                         end;
  424.                         sleep(RandomRange(Task.MinTimeLike, Task.MaxTimeLike));
  425.                       end
  426.                       else
  427.                       begin
  428.                         msg := a.Login + 'не поставили лайк ' + api.GetUser.username;
  429.                         Synchronize(WorkAdd);
  430.                         msg := api.User.respons;
  431.                         Synchronize(WorkAdd);
  432.                       end;
  433.                     end
  434.                     else
  435.                     begin
  436.                       msg := a.Login + ' Сегодня поставили все лайки';
  437.                       Synchronize(WorkAdd);
  438.                     end;
  439.                   end
  440.                   else
  441.                   begin
  442.                     msg := a.Login + ' ' + api.GetUser.username + ' приватный или нет фото';
  443.                     Synchronize(WorkAdd);
  444.                   end;
  445.                 end;
  446.               end;
  447.             pFollow:
  448.               begin
  449.                 if (Task.OFollow = True) and (Task.LimitFollow >= f) then
  450.                 begin
  451.                   if f <= Task.LimitFollow then
  452.                   begin
  453.                     if api.Follow(api.GetUser._uid) then
  454.                     begin
  455.                       msg := a.Login + ' подписались на ' + api.GetUser.username;
  456.                       Synchronize(WorkAdd);
  457.                       Synchronize(FollowAdd);
  458.                       inc(f);
  459.                       inc(All);
  460.                       a.Item.SubItems[5] := l.ToString + '/' + Task.LimitLike.ToString + ' ' + f.ToString + '/' +
  461.                         Task.LimitFollow.ToString + ' ' + u.ToString + '/' + Task.LimitUnfollow.ToString + ' ' +
  462.                         c.ToString + '/' + Task.LimitComment.ToString;
  463.                       if Task.ListBlack <> '' then
  464.                       begin
  465.                         Task.FBlackList.Add(api.GetUser.username);
  466.                         Task.FBlackList.SaveToFile(Task.ListBlack);
  467.                       end;
  468.                       sleep(RandomRange(Task.MinTimeFollow, Task.MaxTimeFollow));
  469.                     end
  470.                     else
  471.                     begin
  472.                       msg := a.Login + ' не подписались на ' + api.GetUser.username;
  473.                       Synchronize(WorkAdd);
  474.                       msg := api.User.respons;
  475.                       Synchronize(WorkAdd);
  476.                     end;
  477.                   end
  478.                   else
  479.                   begin
  480.                     msg := a.Login + ' Сегодня подписались на всех';
  481.                     Synchronize(WorkAdd);
  482.                   end;
  483.                 end;
  484.               end;
  485.             pComment:
  486.               begin
  487.                 if (Task.OComment = True) and (Task.LimitComment >= c) then
  488.                 begin
  489.                   if (api.GetUser.is_private <> True) and (api.GetUser.media_count.ToInteger > 0) then
  490.                   begin
  491.                     if c <= Task.LimitComment then
  492.                     begin
  493.                       api.IdPhotoPars(api.GetUser._uid);
  494.                       if api.Comment(api.Photo[0], Task.CommentList[random(Task.CommentList.Count - 1)]) then
  495.                       begin
  496.                         msg := a.Login + ' прокоментировали ' + api.GetUser.username;
  497.                         Synchronize(WorkAdd);
  498.                         Synchronize(CommentAdd);
  499.                         inc(c);
  500.                         inc(All);
  501.                         a.Item.SubItems[5] := l.ToString + '/' + Task.LimitLike.ToString + ' ' + f.ToString + '/' +
  502.                           Task.LimitFollow.ToString + ' ' + u.ToString + '/' + Task.LimitUnfollow.ToString + ' ' +
  503.                           c.ToString + '/' + Task.LimitComment.ToString;
  504.                         if Task.ListBlack <> '' then
  505.                         begin
  506.                           Task.FBlackList.Add(api.GetUser.username);
  507.                           Task.FBlackList.SaveToFile(Task.ListBlack);
  508.                         end;
  509.                         sleep(RandomRange(Task.MinTimeComment, Task.MaxTimeComment));
  510.                       end
  511.                       else
  512.                       begin
  513.                         msg := a.Login + ' не прокоментировали ' + api.GetUser.username;
  514.                         Synchronize(WorkAdd);
  515.                         msg := api.User.respons;
  516.                         Synchronize(WorkAdd);
  517.                       end;
  518.                     end
  519.                     else
  520.                     begin
  521.                       msg := a.Login + ' Сегодня написали все комменрарии';
  522.                       Synchronize(WorkAdd);
  523.                     end;
  524.                   end
  525.                   else
  526.                   begin
  527.                     msg := a.Login + ' ' + api.GetUser.username + ' приватный или нет фото';
  528.                     Synchronize(WorkAdd);
  529.                   end;
  530.                 end;
  531.               end;
  532.             pUnfollow:
  533.               begin
  534.                 if (Task.OUnfollow = True) and (Task.LimitUnfollow >= u) then
  535.                 begin
  536.                   if u <= Task.LimitUnfollow then
  537.                   begin
  538.                     api.Following(api.User._uid);
  539.                     api.UserInfo(api.IdListUser[0]);
  540.                     if api.UnFollow(api.GetUser._uid) then
  541.                     begin
  542.                       msg := a.Login + ' отписались от ' + api.GetUser.username;
  543.                       Synchronize(WorkAdd);
  544.                       Synchronize(UnfollowAdd);
  545.                       inc(u);
  546.                       inc(All);
  547.                       a.Item.SubItems[5] := l.ToString + '/' + Task.LimitLike.ToString + ' ' + f.ToString + '/' +
  548.                         Task.LimitFollow.ToString + ' ' + u.ToString + '/' + Task.LimitUnfollow.ToString + ' ' +
  549.                         c.ToString + '/' + Task.LimitComment.ToString;
  550.                       if Task.ListBlack <> '' then
  551.                       begin
  552.                         Task.FBlackList.Add(api.GetUser.username);
  553.                         Task.FBlackList.SaveToFile(Task.ListBlack);
  554.                       end;
  555.                       sleep(RandomRange(Task.MinTimeUnfollow, Task.MaxTimeUnfollow));
  556.                     end
  557.                     else
  558.                     begin
  559.                       msg := a.Login + ' не отписались от ' + api.GetUser.username;
  560.                       Synchronize(WorkAdd);
  561.                       msg := api.User.respons;
  562.                       Synchronize(WorkAdd);
  563.                     end;
  564.                   end
  565.                   else
  566.                   begin
  567.                     msg := a.Login + ' Сегодня отписались от всех';
  568.                     Synchronize(WorkAdd);
  569.                   end;
  570.                 end;
  571.               end;
  572.             pSave:
  573.               begin
  574.                 if Task.OSave = True then
  575.                 begin
  576.                   if (api.GetUser.is_private <> True) and (api.GetUser.media_count.ToInteger > 0) then
  577.                   begin
  578.                     api.PhotoSave(api.GetUser._uid);
  579.                     msg := a.Login + ' сохранили фото ' + api.GetUser.username;
  580.                     Synchronize(WorkAdd);
  581.                     sleep(RandomRange(5, 10) * 1000);
  582.                   end
  583.                   else
  584.                   begin
  585.                     msg := a.Login + ' ' + api.GetUser.username + ' приватный или нет фото';
  586.                     Synchronize(WorkAdd);
  587.                   end;
  588.                 end;
  589.               end;
  590.             pViewStory:
  591.               begin
  592.                 if Task.OViewStory = True then
  593.                 begin
  594.                   if (api.GetUser.is_private <> True) then
  595.                   begin
  596.                     api.ViewStory(api.GetUser._uid);
  597.                     msg := a.Login + ' просмотрели стори ' + api.GetUser.username;
  598.                     Synchronize(WorkAdd);
  599.                     sleep(RandomRange(5, 10) * 1000);
  600.                   end;
  601.                 end;
  602.               end;
  603.           end;
  604.         end;
  605.       end;
  606.       sleep(RandomRange(5, 10) * 1000);
  607.     until All >= (Task.FLimitLike + Task.FLimitFollow + Task.FLimitComment + Task.FLimitUnfollow);
  608.     All := 0;
  609.   end
  610.   else
  611.   begin
  612.     msg := a.Login + ' не авторизовались';
  613.     Synchronize(WorkAdd);
  614.     msg := a.Login + ' ' + api.User.respons;
  615.     Synchronize(WorkAdd);
  616.   end;
  617.   a.Status := False;
  618.   msg := a.Login + ' завершили работу';
  619.   Synchronize(WorkAdd);
  620.   a.Item.SubItems[2] := 'Завершили работу';
  621. end;
  622.  
  623. procedure Thread.FollowAdd;
  624. begin
  625.   AllAdd;
  626.   Form1.sLabel9.Caption := inttostr(strtoint(Form1.sLabel9.Caption) + 1);
  627. end;
  628.  
  629. procedure Thread.httperror(txt: string);
  630. begin
  631.   msg := a.Login + ' ' + txt;
  632.   Synchronize(WorkAdd);
  633. end;
  634.  
  635. procedure Thread.LikeAdd;
  636. begin
  637.   AllAdd;
  638.   Form1.sLabel8.Caption := inttostr(strtoint(Form1.sLabel8.Caption) + 1);
  639. end;
  640.  
  641. procedure Thread.RandomAction(api: TInstagramAPI; Task: TTask);
  642. var
  643.   oi: integer;
  644.   r: TRandom;
  645. begin
  646.   for oi := 0 to Task.RandomO - 1 do
  647.   begin
  648.     Randomize;
  649.     r := Task.FRandomList[random(Task.RandomList.Count)];
  650.     case r of
  651.       pViewLenta:
  652.         begin
  653.           if Task.ROViewLenta = True then
  654.           begin
  655.             api.TimeLine;
  656.             msg := '[рандом] ' + api.Login + ' просмотрели ленту';
  657.             WorkAdd;
  658.             Task.LifeId.AddStrings(api.IdTimeLineList);
  659.             Task.LifePhoto.AddStrings(api.PhotoTimeLineList);
  660.             if (Task.UsesLife = True) or (Task.LifeBase = True) then
  661.             begin
  662.               msg := '[информация] в лайф базе : ' + Task.LifePhoto.Count.ToString + ' фото ,' +
  663.                 Task.LifeId.Count.ToString + ' юзеров';
  664.               WorkAdd;
  665.             end;
  666.             RandomAction2(api, Task);
  667.           end;
  668.         end;
  669.       pViewNew:
  670.         begin
  671.           if Task.ROViewNew then
  672.           begin
  673.             api.RecentActivityInbox;
  674.             msg := '[рандом] ' + api.Login + ' просмотрели новости свои';
  675.             WorkAdd;
  676.             Task.LifeId.AddStrings(api.IdTimeLineList);
  677.             begin
  678.               msg := '[информация] в лайф базе : ' + Task.LifePhoto.Count.ToString + ' фото ,' +
  679.                 Task.LifeId.Count.ToString + ' юзеров';
  680.               WorkAdd;
  681.             end;
  682.             RandomAction2(api, Task);
  683.           end;
  684.         end;
  685.       pViewNewUser:
  686.         begin
  687.           if Task.ROViewNewUser = True then
  688.           begin
  689.             api.RecentActivityInboxUser;
  690.             msg := '[рандом] ' + api.Login + ' просмотрели новости подписчиков';
  691.             WorkAdd;
  692.             Task.LifeId.AddStrings(api.IdTimeLineList);
  693.             Task.LifePhoto.AddStrings(api.PhotoTimeLineList);
  694.             begin
  695.               msg := '[информация] в лайф базе : ' + Task.LifePhoto.Count.ToString + ' фото ,' +
  696.                 Task.LifeId.Count.ToString + ' юзеров';
  697.               WorkAdd;
  698.             end;
  699.             RandomAction2(api, Task);
  700.           end;
  701.         end;
  702.       pViewPopular:
  703.         begin
  704.           if Task.ROViewPopular = True then
  705.           begin
  706.             api.Popular;
  707.             msg := '[рандом] ' + api.Login + ' просмотрели популярное';
  708.             WorkAdd;
  709.             Task.LifeId.AddStrings(api.IdTimeLineList);
  710.             Task.LifePhoto.AddStrings(api.PhotoTimeLineList);
  711.             begin
  712.               msg := '[информация] в лайф базе : ' + Task.LifePhoto.Count.ToString + ' фото ,' +
  713.                 Task.LifeId.Count.ToString + ' юзеров';
  714.               WorkAdd;
  715.             end;
  716.             RandomAction2(api, Task);
  717.           end;
  718.         end;
  719.     end;
  720.     sleep(RandomRange(3, 10) * 1000);
  721.   end;
  722. end;
  723.  
  724. procedure Thread.RandomAction2(api: TInstagramAPI; Task: TTask);
  725. var
  726.   UserRandom: string;
  727.   r: TRandomDop;
  728.   di: integer;
  729. begin
  730.   for di := 0 to Task.RandomD - 1 do
  731.   begin
  732.     Randomize;
  733.     r := Task.FRandomListD[random(Task.FRandomListD.Count)];
  734.     case r of
  735.       pLikeD:
  736.         begin
  737.           if (Task.RLike = True) and (Task.LifePhoto.Text <> '') then
  738.           begin
  739.             repeat
  740.               Randomize;
  741.               UserRandom := Task.LifePhoto[random(Task.LifePhoto.Count - 1)];
  742.             until UserRandom <> '';
  743.             api.InfoPost(UserRandom);
  744.             msg := '[рандом доп.] ' + api.Login + ' поставили лайк рандомной записи у ' + api.GetUser.username;
  745.             WorkAdd;
  746.             LikeAdd;
  747.             api.Like(UserRandom);
  748.             sleep(RandomRange(Task.MinTimeLike, Task.MaxTimeLike) * 1000);
  749.           end;
  750.         end;
  751.       pFollowD:
  752.         begin
  753.           if (Task.RFollow = True) and (Task.LifeId.Text <> '') then
  754.           begin
  755.             repeat
  756.               Randomize;
  757.               UserRandom := Task.LifeId[random(Task.LifeId.Count - 1)];
  758.               sleep(RandomRange(1, 3) * 1000);
  759.             until UserRandom <> '';
  760.             msg := '[рандом доп.] ' + api.Login + ' подписались на ' + UserRandom;
  761.             WorkAdd;
  762.             FollowAdd;
  763.             api.UserInfo(UserRandom);
  764.             api.Follow(api.GetUser._uid);
  765.             sleep(RandomRange(Task.MinTimeFollow, Task.MaxTimeFollow) * 1000);
  766.           end;
  767.         end;
  768.       pCommentD:
  769.         begin
  770.           if (Task.RComment = True) and (Task.LifePhoto.Text <> '') then
  771.           begin
  772.             if Task.CommentList.Count <> 0 then
  773.             begin
  774.               repeat
  775.                 repeat
  776.                   Randomize;
  777.                   UserRandom := Task.LifeId[random(Task.LifeId.Count - 1)];
  778.                 until UserRandom <> '';
  779.                 api.UserInfo(UserRandom);
  780.                 sleep(RandomRange(1, 3) * 1000);
  781.               until (api.GetUser.is_private <> True) and (api.GetUser.media_count.ToInteger > 0);
  782.  
  783.               api.IdPhotoPars(api.GetUser._uid);
  784.               msg := '[рандом доп.] ' + api.Login + ' прокоментировали случайную запись ' + api.GetUser.username;
  785.               WorkAdd;
  786.               CommentAdd;
  787.               api.Comment(api.Photo[0], ansitoutf8(Task.CommentList[random(Task.CommentList.Count - 1)]));
  788.               sleep(RandomRange(Task.MinTimeComment, Task.MaxTimeComment) * 1000);
  789.             end;
  790.           end;
  791.         end;
  792.       pSaveD:
  793.         begin
  794.           if (Task.RSave = True) and (Task.LifeId.Text <> '') then
  795.           begin
  796.             repeat
  797.               repeat
  798.                 Randomize;
  799.                 UserRandom := Task.LifeId[random(Task.LifeId.Count - 1)];
  800.               until UserRandom <> '';
  801.               api.UserInfo(UserRandom);
  802.               sleep(RandomRange(1, 3) * 1000);
  803.             until (api.GetUser.is_private <> True) and (api.GetUser.media_count.ToInteger > 0);
  804.             msg := '[рандом доп.] ' + api.Login + ' сохранили случайный пост у ' + api.GetUser.username;
  805.             WorkAdd;
  806.             api.PhotoSave(UserRandom);
  807.           end;
  808.         end;
  809.       pViewStoryD:
  810.         begin
  811.           if (Task.RViewStory = True) and (Task.LifeId.Text <> '') then
  812.           begin
  813.             repeat
  814.               repeat
  815.                 Randomize;
  816.                 UserRandom := Task.LifeId[random(Task.LifeId.Count - 1)];
  817.               until UserRandom <> '';
  818.               api.UserInfo(UserRandom);
  819.               sleep(RandomRange(1, 3) * 1000);
  820.             until api.GetUser.is_private <> True;
  821.             msg := '[рандом доп.] ' + api.Login + ' просмотрели стори у ' + api.GetUser.username;
  822.             WorkAdd;
  823.             api.ViewStory(api.GetUser.username);
  824.           end;
  825.         end;
  826.     end;
  827.     sleep(RandomRange(3, 10) * 1000);
  828.   end;
  829. end;
  830.  
  831. procedure Thread.WorkAdd;
  832. begin
  833.   a.Log.Add('[' + Timetostr(now) + '] ' + msg);
  834.   Form1.sMemo1.Lines.Add('[' + Timetostr(now) + '] ' + msg);
  835. end;
  836.  
  837. { TAccount }
  838.  
  839. constructor TAccount.Create(Login, Pass, Proxy: string);
  840. begin
  841.   FLogin := Login;
  842.   FPass := Pass;
  843.   FProxy := Proxy;
  844.   FLog := TStringList.Create;
  845. end;
  846.  
  847. destructor TAccount.Destroy;
  848. begin
  849.   FLog.Free;
  850. end;
  851.  
  852. function TAccount.GenId: string;
  853. var
  854.   MyGUID: TGUID;
  855. begin
  856.   CreateGUID(MyGUID);
  857.   Result := trim(GUIDToString(MyGUID).Replace('{', '').Replace('}', '').ToLower);
  858. end;
  859.  
  860. { TTask }
  861.  
  862. constructor TTask.Create(PList: TList<TAccount>);
  863. var
  864.   i: integer;
  865. begin
  866.   FList := TList<TAccount>.Create;
  867.   FBasis := TList<TBasis>.Create;
  868.   FRandomList := TList<TRandom>.Create;
  869.   FRandomListD := TList<TRandomDop>.Create;
  870.  
  871.   FCommentList := TStringList.Create;
  872.  
  873.   FBaseList := TStringList.Create;
  874.   FBaseList.Duplicates := dupIgnore;
  875.   FBaseList.Sorted := True;
  876.  
  877.   FBlackList := TStringList.Create;
  878.   FBlackList.Duplicates := dupIgnore;
  879.   FBlackList.Sorted := True;
  880.  
  881.   FLifeId := TStringList.Create;
  882.   FLifeId.Duplicates := dupIgnore;
  883.   FLifeId.Sorted := True;
  884.   FLifeId.Add('katyachupinaaa');
  885.   FLifeId.Add('instagramru');
  886.   FLifeId.Add('instagram');
  887.  
  888.   FLifePhoto := TStringList.Create;
  889.   FLifePhoto.Duplicates := dupIgnore;
  890.   FLifePhoto.Sorted := True;
  891.   FLifePhoto.Add('1603096989499430875_638144925');
  892.   FLifePhoto.Add('1602347163245836834_638144925');
  893.  
  894.   FId := GenId;
  895.   // cs := TCriticalSection.Create;
  896.   for i := 0 to PList.Count - 1 do
  897.   begin
  898.     FList.Add(PList[i]);
  899.     FList[i].Id := FId;
  900.   end;
  901. end;
  902.  
  903. destructor TTask.Destroy;
  904. begin
  905.   FCommentList.Free;
  906.   FBaseList.Free;
  907.   FBlackList.Free;
  908.   FLifeId.Free;
  909.   FLifePhoto.Free;
  910.   FList.Free;
  911.   FBasis.Free;
  912.   FRandomList.Free;
  913.   FRandomListD.Free;
  914.   // cs.Destroy;
  915. end;
  916.  
  917. function TTask.NextUser: string;
  918. var
  919.   str: string;
  920. begin
  921.   if FBaseList.Count <> 0 then
  922.   begin
  923.     Result := '';
  924.     cs.Enter;
  925.     try
  926.       str := FBaseList[0];
  927.       FBaseList.Delete(0);
  928.       Result := str;
  929.     finally
  930.       cs.Leave;
  931.     end;
  932.   end
  933.   else
  934.   begin
  935.     Result := '';
  936.   end;
  937. end;
  938.  
  939. function TTask.NextUserLife: string;
  940. var
  941.   str: string;
  942. begin
  943.   if FLifeId.Count <> 0 then
  944.   begin
  945.     Result := '';
  946.     cs.Enter;
  947.     try
  948.       str := FLifeId[0];
  949.       FLifeId.Delete(0);
  950.       Result := str;
  951.     finally
  952.       cs.Leave;
  953.     end;
  954.   end
  955.   else
  956.   begin
  957.     Result := '';
  958.   end;
  959. end;
  960.  
  961. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement