Untitled

 avatar
user_2299906
plain_text
2 years ago
2.3 kB
2
Indexable
Never
  public Task<string> PostAsync(string url, string data)
        {
            var restk = Task.Run(async () =>
            {
                if(string.IsNullOrEmpty(LSD))
                {
                    Get("https://www.facebook.com").Wait();
                }    
                if (string.IsNullOrEmpty(User)) User = UID;
                if (string.IsNullOrEmpty(datapost)) datapost = $"av={User}&__user={UID}&__a=1&__dyn=&__csr=&__req=&__hs=&dpr=&__ccg=&__rev=&__s=&__hsi=&__comet_req=15&fb_dtsg={Fb_dtsg}&jazoest={Jazoest}&lsd={LSD}&__spin_r=&__spin_b=&__spin_t=&fb_api_caller_class=RelayModern";
                url = url.Replace("{Var:Data}", datapost).Replace("{Var:Fb_dtsg}", Fb_dtsg).Replace("{Var:LSD}", LSD).Replace("{Var:Jazoest}", Jazoest);

                request = new RestRequest(url);
                request.AddHeader("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
                request.AddHeader("sec-fetch-site", "same-origin");
                request.AddHeader("sec-fetch-dest", "empty");
                request.AddHeader("accept-language", "en-US,en;q=0.9");
                request.AddHeader("sec-fetch-mode", "cors");
                if(!string.IsNullOrEmpty(referer)) request.AddHeader("referer", referer);
                else
                request.AddHeader("referer", "https://www.facebook.com/");
                request.AddHeader("sec-ch-ua-platform", "\"Windows\"");
                if (!string.IsNullOrEmpty(LSD)) request.AddHeader("x-fb-lsd", LSD);
                if (string.IsNullOrEmpty(data) || data.Contains("variables=")) data = datapost + data;
                else data = data.Replace("{Var:Fb_dtsg}", Fb_dtsg).Replace("{Var:LSD}", LSD).Replace("{Var:Jazoest}", Jazoest).Replace("{Var:Data}", datapost);
                request.AddStringBody(data, "application/x-www-form-urlencoded");
                request.Method = Method.Post;
                var res = await Client.ExecuteAsync(request);
                html = res?.Content;
                string error = GetError(html);
                if (!string.IsNullOrEmpty(error)) return error;
                return res?.Content;
            });
            return restk;

        }