Untitled

 avatar
user_2299906
plain_text
a year ago
1.6 kB
5
Indexable
Never
  public string UploadIMGProfile(RestClient Client,string UID,string Fb_dtsg,string Jazoest,string LSD,string fileimg,string nameanh ="image")
        {
            
            RestRequest request = new RestRequest($"https://upload.facebook.com/ajax/react_composer/attachments/photo/upload?av={UID}&__user={UID}&__a=1&fb_dtsg={Fb_dtsg}&jazoest={Jazoest}&lsd={LSD}");
            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("x-fb-lsd", LSD);
            request.AddHeader("referer", "https://www.facebook.com/");
            request.AddHeader("sec-ch-ua-platform", "\"Windows\"");
            string typeanh = "image/png";

            if (fileimg.ToLower().IsContains("jpg")) typeanh = "image/jpg";
            request.AddParameter("source", "8");
            request.AddParameter("profile_id", User);
            request.AddParameter("waterfallxapp", "comet");
            request.AddParameter("upload_id", "jsc_c_1u");
            request.AddFile(nameanh, fileimg, typeanh);
            request.Method = Method.Post;
            var res = Client.Execute(request);
            string html = res?.Content;

            return Regex.Match(html, "photoID\":\"(\\d+)").Groups[1].Value;
        }