Untitled

 avatar
user_2299906
plain_text
2 years ago
2.3 kB
1
Indexable
Never
public Task<string> GraphApi(string data)
        {
            var restk = Task.Run(async () =>
            {
                if (string.IsNullOrEmpty(LSD) && _Cookie != "locale=vi_VN;")
                {
                    Get("https://www.facebook.com/").Wait();
                }
                request = new RestRequest("https://www.facebook.com/api/graphql/");
                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");
                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(User)) User = UID;
                    if (string.IsNullOrEmpty(datapost) || User != UID) 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";
                }
                if (!string.IsNullOrEmpty(data)) data = data.Replace("{Var:UID}", UID);
                if (!data.Contains("&__user=") && !string.IsNullOrEmpty(UID)) data = datapost + "&" + data.TrimStart('&');
                else data = data.Replace("{Var:Fb_dtsg}", Fb_dtsg).Replace("{Var:LSD}", LSD).Replace("{Var:Jazoest}", Jazoest);
                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;
        }