string mail = "[email protected]";
string password = "password123445";
string data = "source_url=/&data={\"options\":{\"username_or_email\":\""+mail+"\",\"password\":\""+password+"\"},\"context\":{}}";
string url = "https://www.pinterest.com/resource/UserSessionResource/create/";
string X_CSRFToken = "K4C0QUu35Eoq1xjajbMluw7hOKibpQSW";
string[] header = new string[] { "Accept: application/json, text/javascript, */*; q=0.01",
"Accept-Language: en-US,en;q=0.5",
"Cache-Control: no-cache",
"DNT: 1",
"Host: www.pinterest.com",
"Origin: https://www.pinterest.com",
"Referer: https://www.pinterest.com/",
"X-APP-VERSION: 18733c1",
string.Format(@"X-CSRFToken: {0}", X_CSRFToken),
"X-NEW-APP: 1",
"X-Pinterest-AppState: active",
"X-Requested-With: XMLHttpRequest"
};
string auth = ZennoPoster.HttpPost(url, data, @"application/x-www-form-urlencoded", "", "UTF-8", ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.HeaderAndBody, 30000, "_auth=0; csrftoken=K4C0QUu35Eoq1xjajbMluw7hOKibpQSW", project.Profile.UserAgent, false, 0, header);
Regex re_cookie = new Regex(@"(?<=Set-Cookie:).*?(?=;)");
MatchCollection auth_cookie = re_cookie.Matches(auth);
List<string> list_cookie = new List<string>();
for (int i = 0; i < auth_cookie.Count; i++) {
if(auth_cookie[i].Value.Contains("csrftoken") )X_CSRFToken = auth_cookie[i].Value.ToString().Split('=')[1].Trim();
list_cookie.Add(auth_cookie[i].Value.Trim());
}
string cookie = string.Join("; ", list_cookie);
url = "https://www.pinterest.com/";
header = new string[] { "Accept: application/json, text/javascript, */*; q=0.01",
"Accept-Language: en-US,en;q=0.5",
"Cache-Control: no-cache",
"DNT: 1",
"Host: www.pinterest.com",
"Origin: https://www.pinterest.com",
"Referer: https://www.pinterest.com/",
"X-APP-VERSION: 18733c1",
string.Format(@"X-CSRFToken: {0}", X_CSRFToken),
"X-NEW-APP: 1",
"X-Pinterest-AppState: active",
"X-Requested-With: XMLHttpRequest"
};
return ZennoPoster.HttpGet( url, "", "UTF-8", ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly, 30000, cookie, project.Profile.UserAgent, true, 0, header);