public AccountStatus Logining(ref Captcha captcha) { // Если это первое обращение, то устанавливаем новые куки. if (captcha == null) { Cookies = new CookieDictionary(); Request.Cookies = Cookies; } Request.AddParam("login", Login).AddParam("password", Password); // Если до этого требовался ввод капчи. if (captcha != null) { Request.AddParam("c_key", captcha.Key); } string loginingResult = Request.Post("/logining.php").ToString(); // Если требуется ввод капчи. if (loginingResult.Contains("need_captcha")) { string captchaUrl = loginingResult.Substring("captcha_url=", "&"); captcha = new Captcha(captchaUrl); return(AccountStatus.None); } if (loginingResult.Contains("ok")) { return(AccountStatus.Valid); } return(AccountStatus.NotValid); }
public AccountStatus Logining(ref Captcha captcha) { // Если это первое обращение, то устанавливаем новые куки. if (captcha == null) { Cookies = new CookieDictionary(); Request.Cookies = Cookies; } Request.AddParam("login", Login).AddParam("password", Password); // Если до этого требовался ввод капчи. if (captcha != null) { Request.AddParam("c_key", captcha.Key); } string loginingResult = Request.Post("/logining.php").ToString(); // Если требуется ввод капчи. if (loginingResult.Contains("need_captcha")) { string captchaUrl = loginingResult.Substring("captcha_url=", "&"); captcha = new Captcha(captchaUrl); return AccountStatus.None; } if (loginingResult.Contains("ok")) { return AccountStatus.Valid; } return AccountStatus.NotValid; }
private void Avthorization(bool isProxt) { try { Init(isProxt); var htm = httpRequest.Get("https://www.centraldispatch.com/login?uri=%2Fprotected%2F").ToString(); Tokene = httpRequest.Cookies.GetValueOrDefault("CSRF_TOKEN", ""); //Regex.Match(htm, @"CSRFToken.{4}lue\W\W(\w+)").Groups[1].Value; httpRequest.AddParam("Username", "ATS2019"); httpRequest.AddParam("Password", "Dispatch35221!"); httpRequest.AddParam("r", ""); httpRequest.AddParam("CSRFToken", Tokene); var res = httpRequest.Post("https://www.centraldispatch.com/login?uri=/protected/"); cooks = httpRequest.Cookies; if (res.Cookies.Count >= 5) { } else { } } catch (HttpException e) { string ipProxy = httpRequest.Proxy != null ? httpRequest.Proxy.Host : "CurrentIp"; Avthorization(true); } catch { } }
private void btnStart_Click(object sender, EventArgs e) { #region Login and password Properties.Settings.Default.login = tbLogin.Text; Properties.Settings.Default.password = tbPassword.Text; Properties.Settings.Default.Save(); #endregion CookieDictionary cookie = nethouse.CookieNethouse(tbLogin.Text, tbPassword.Text); if (cookie.Count != 4) { MessageBox.Show("Логин или пароль введены не верно!"); return; } chekedSEO = cbSEO.Checked; chekedMiniText = cbMinitext.Checked; chekedFullText = cbFullText.Checked; minitextTemplate = MinitextStr(); fullTextTemplate = FulltextStr(); keywordsTextTemplate = tbKeywords.Lines[0].ToString(); titleTextTemplate = tbTitle.Lines[0].ToString(); descriptionTextTemplate = tbDescription.Lines[0].ToString(); File.Delete("naSite.csv"); nethouse.NewListUploadinBike18("naSite"); Thread tabl = new Thread(() => UpdateTovar(cookie)); forms = tabl; forms.IsBackground = true; forms.Start(); }
private void Avthorization(bool isProxt) { try { LogEr.Logerr("Info", "Login start", "Avthorization", DateTime.Now.ToShortTimeString()); Init(isProxt); var htm = httpRequest.Get("https://www.centraldispatch.com/login?uri=%2Fprotected%2F").ToString(); Tokene = Regex.Match(htm, @"CSRFToken.{4}lue\W\W(\w+)").Groups[1].Value; httpRequest.AddParam("Username", "ATS2019"); httpRequest.AddParam("Password", "Dispatch35221!"); httpRequest.AddParam("r", ""); httpRequest.AddParam("CSRFToken", Tokene); var res = httpRequest.Post("https://www.centraldispatch.com/login?uri=/protected/"); cooks = httpRequest.Cookies; if (res.Cookies.Count >= 5) { LogEr.Logerr("Info", "Login successful", "Avthorization", DateTime.Now.ToShortTimeString()); } else { LogEr.Logerr("Error", "Not successful authorization 'wrong password or login'", "Avthorization", DateTime.Now.ToShortTimeString()); } } catch (HttpException e) { string ipProxy = httpRequest.Proxy != null ? httpRequest.Proxy.Host : "CurrentIp"; LogEr.Logerr("Error", $"Authorization error, IP: {ipProxy}", "Avthorization", DateTime.Now.ToShortTimeString()); Avthorization(true); } catch { LogEr.Logerr("Error", "Critical authorization error'", "Avthorization", DateTime.Now.ToShortTimeString()); } }
/// <summary> /// Метод решения ImagesCaptcha /// </summary> /// <param name="URLToCaptcha">Ссылка на Captcha</param> /// <param name="account">Аккаунт</param> /// <returns></returns> public static string GetImagesCaptcha(string URLToCaptcha, CookieDictionary cookieDictionary, string account) { try { SaveData.WriteToLog(account, "Решаем ImagesCaptcha"); using (HttpRequest request = new HttpRequest()) { request.Cookies = cookieDictionary; var base64 = Convert.ToBase64String(request.Get(URLToCaptcha).ToBytes()); string json = $"{{\"clientKey\":\"{ClientKey}\",\"task\":{{\"type\":\"ImageToTextTask\",\"body\":\"{base64}\",\"phrase\":false,\"case\":false,\"numeric\":false,\"math\":0,\"minLength\":0,\"maxLength\":0}}}}"; string taskID = request.Post("https://api.anti-captcha.com/createTask ", json, "application/json").ToString(); taskID = taskID.Substring("\"taskId\":", "}"); for (int i = 0; i < 50; i++) { Thread.Sleep(5000); string result = request.Post("https://api.anti-captcha.com/getTaskResult", $"{{\"clientKey\": \"{ClientKey}\",\"taskId\": {taskID}}}", "application/json").ToString(); if (result.Contains("\"errorId\":0,\"status\":\"ready\"")) { SaveData.WriteToLog(account, "ImagesCaptcha решена."); return(result.Substring("\"text\":\"", "\"")); } } } } catch (Exception exception) { MessageBox.Show(exception.Message); } SaveData.WriteToLog("Captcha", "Не смогли решить ImagesCaptcha"); return(""); }
private void UploadImages() { cookie = nethouse.CookieNethouse(tbLoginNethouse.Text, tbPassNethouse.Text); if (cookie.Count == 1) { MessageBox.Show("Логин или пароль для сайта Nethouse введены не верно", "Ошибка логина/пароля"); return; } ControlsFormEnabledFalse(); countUpdateImage = 0; otv = nethouse.getRequest("https://bike18.ru/products/category/zapchasti-dlya-pitbikov"); MatchCollection razdel = new Regex("(?<=class=\"category-item__link\"><a href=\").*?(?=\">)").Matches(otv); for (int i = 0; razdel.Count > i; i++) { otv = nethouse.getRequest("https://bike18.ru" + razdel[i].ToString() + "?page=all"); MatchCollection tovar = new Regex("(?<=class=\"product-item__content\"><a href=\").*(?=\")").Matches(otv); foreach (Match s in tovar) { string urlTovar = s.ToString(); UpdateImage(urlTovar); } } MessageBox.Show("Обновленно " + countUpdateImage + "карточек товара"); ControlsFormEnabledTrue(); }
private void Auth() { GetInfoAuth(); try { using (HttpRequest net = new HttpRequest()) { string[] Links = WhatCompany(Company); //узнаем что за провайдер net.UserAgent = Http.FirefoxUserAgent(); //и так понятно CookieDictionary cookie = new CookieDictionary(false); //тоже понятно net.Cookies = cookie; //и тут тоже var reqParams = new RequestParams(); //шлет пост запрос reqParams["user"] = Login; //шлет логин в поле user reqParams["pswd"] = Pass; //шлет пароль в поле pswd string content = net.Post(Links[1], reqParams).ToString(); //шлем запрос на узказанную ссылку с логином и паролем string ID = content.Substring("var contractId = ", ";"); //узнаю свой ID чтоб прыгать по страницам(перейти к вкладки баланс) html = net.Get(Links[0] + ID).ToString(); //на сайте переходим на страницу баланс и получаем весь html // // // Items = getValueSite(html, LenghtItem); CalculateInfo(Company); } } catch { returnText = "Нет подключения к интернету"; } }//Авторизуемся
public void Auth(string NameCompany, string Login, string Password) { try { using (HttpRequest net = new HttpRequest()) { string[] Links = this.NameCompany(NameCompany); string GetInfo = Links[0]; net.UserAgent = Http.FirefoxUserAgent(); CookieDictionary cookie = new CookieDictionary(false); net.Cookies = cookie; var reqParams = new RequestParams(); reqParams["user"] = Login; reqParams["pswd"] = Password; string content = net.Post(Links[1], reqParams).ToString(); string ID = content.Substring("var contractId = ", ";"); html = net.Get(GetInfo + ID).ToString(); Items = getValuesite(html, LenghtItem); CalculateInfo(NameCompany); AddLabelOnGrid(Panel, LenghtItem); BoolAuth = true; } } catch { MessageBox.Show("Вы ввели неверный логин или пароль.Пожалуйста перепроверте!"); BoolAuth = false; } }//Авторизуемся
/// <summary> /// Creates a BotData object given some parameters. /// </summary> /// <param name="globalSettings">The global RuriLib settings</param> /// <param name="configSettings">The settings for the current Config</param> /// <param name="data">The wrapped data line to check</param> /// <param name="proxy">The proxy to use (set to null if none)</param> /// <param name="useProxies">Whether to use the proxy for requests</param> /// <param name="botNumber">The number of the bot that is creating this object</param> /// <param name="isDebug">Whether this object is created from a Debugger or from a Runner</param> public BotData(RLSettingsViewModel globalSettings, ConfigSettings configSettings, CData data, CProxy proxy, bool useProxies, int botNumber = 0, bool isDebug = true) { Data = data; Proxy = proxy; UseProxies = useProxies; Status = BotStatus.NONE; BotNumber = BotNumber; GlobalSettings = globalSettings; ConfigSettings = configSettings; Balance = 0; Screenshots = new List <string>(); Variables = new VariableList(); // Populate the Variables list with hidden variables Address = ""; ResponseCode = "0"; ResponseSource = ""; Cookies = new Dictionary <string, string>(); ResponseHeaders = new Dictionary <string, string>(); try { foreach (var v in Data.GetVariables()) { Variables.Set(v); } } catch { } GlobalVariables = new VariableList(); GlobalCookies = new CookieDictionary(); LogBuffer = new List <LogEntry>(); Driver = null; BrowserOpen = false; IsDebug = isDebug; BotNumber = botNumber; }
public string GetCheckSum(CookieDictionary cookies) { cookies.TryGetValue("beaker.session.id", out string FullCheckSum); string CheckSum = FullCheckSum.Substring(0, 10); return(CheckSum); }
public override bool CheckExtra(Account account) { using (var request = new HttpRequest()) { try { var cookies = new CookieDictionary(); request.Cookies = cookies; request.IgnoreProtocolErrors = true; request.ConnectTimeout = 10 * 1000; request.AllowAutoRedirect = true; request.KeepAlive = true; var response = request.Get(UrlEndpoint + account.Username + ".png"); return(response.StatusCode == HttpStatusCode.OK); } catch { return(false); } } return(false); }
public static string Like(CookieDictionary Cookie, string Url) { //Потом доделаю using (var request = new HttpRequest()) { string CSRF = null; Cookie.TryGetValue("csrftoken", out CSRF); request.Cookies = Cookie; request.Referer = Url; request.UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile Safari/600.1.4"; request.AddHeader("X-CSRFToken", CSRF) .AddHeader("X-Instagram-AJAX", "1") .AddHeader("X-Requested-With", "XMLHttpRequest"); var response = request.Post(Url); //Парсим ответ хмл HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(response.ToString()); //Как-то блять находим там нужный нам айди поста string metaid = doc.DocumentNode.SelectSingleNode("/html/head/meta[18]").OuterHtml.Remove(0, 58).Remove(19, 2); request.AddHeader("X-CSRFToken", CSRF) .AddHeader("X-Instagram-AJAX", "1") .AddHeader("X-Requested-With", "XMLHttpRequest"); //Луйкаем response = request.Post("https://www.instagram.com/web/likes/" + metaid + "/like/"); return(response.ToString()); } }
private void FindDeleteProduct(CookieDictionary cookie, string url, string[] allTovars) { List <string> tovar = new List <string>(); tovar = nethouse.GetProductList(cookie, url); string articleB18 = tovar[6].ToString(); string nameB18 = tovar[4].ToString(); if (!articleB18.Contains("DB_")) { return; } bool b = false; foreach (string s in allTovars) { string[] str = s.Split(';'); string name = str[1]; string articl = str[0]; if (articl == articleB18 && name == nameB18) { b = true; break; } } if (!b) { nethouse.DeleteProduct(cookie, tovar); delTovar++; } }
public static MCAccount GetAccountBySite(string Username, string Password) { using (var request = new HttpRequest()) { CookieDictionary cookies = new CookieDictionary(); request.Cookies = cookies; request.AllowAutoRedirect = false; var reqParams = new RequestParams(); reqParams["username"] = Username; reqParams["password"] = Password; HttpResponse response; try { response = request.Post("https://account.mojang.com/login", reqParams); } catch { return(new MCAccount(Username, Password)); } if (!response.Location.StartsWith("https://account.mojang.com/me")) { return(new MCAccount(Username, Password)); } var Name = string.Empty; var IsPremium = false; var IsSecureQuestion = true; var HasGifts = false; var UserProfile = request.Get(response.Location); if (UserProfile.Location == "https://account.mojang.com/me/challenge") { return(new MCAccount(Name, Username, Password, true, true, false)); } if (UserProfile.ToString().Contains("Secure my account")) { IsSecureQuestion = false; } if (UserProfile.ToString().Contains("My Games")) { IsPremium = true; } if (UserProfile.ToString().Contains("<th>Gift Code</th>")) { HasGifts = true; } return(new MCAccount(Name, Username, Password, IsPremium, IsSecureQuestion, HasGifts)); } }
private void UpdatePrice(CookieDictionary cookie, string urlSearch, string[] tovarDB) { bool edits = false; string article = tovarDB[0]; string name = tovarDB[1]; string price = tovarDB[2]; string miniText = tovarDB[3]; string fullText = tovarDB[4]; List <string> productB18 = new List <string>(); productB18 = nethouse.GetProductList(cookie, urlSearch); if (productB18 == null) { return; } int priceDB = Convert.ToInt32(price); int priceB18 = Convert.ToInt32(productB18[9]); if (priceB18 != priceDB) { productB18[9] = priceDB.ToString(); edits = true; } if (chekedSEO) { string titleText = ReplaceSEO(titleTextTemplate, name, article); string descriptionText = ReplaceSEO(descriptionTextTemplate, name, article); string keywordsText = ReplaceSEO(keywordsTextTemplate, name, article); productB18[11] = nethouse.Remove(descriptionText, 200); productB18[12] = nethouse.Remove(keywordsText, 100); productB18[13] = nethouse.Remove(titleText, 255); edits = true; } if (chekedMiniText) { miniText = Replace(miniTextTemplate, name, article, miniText, ""); productB18[7] = miniText; edits = true; } if (chekedFullText) { fullText = Replace(fullTextTemplate, name, article, "", fullText); productB18[8] = fullText; edits = true; } if (edits) { nethouse.SaveTovar(cookie, productB18); editsProduct++; } }
public string SetCookies(CookieDictionary cookies) { string Cookies = string.Empty; Cookies = cookies.ToString(); this.cookies = Cookies; return(Cookies); }
private List <string> GetListTovar(string url, CookieDictionary cookie) { List <string> tovar = new List <string>(); string otv = null; string name = null; string article = null; string price = null; string category = null; string miniText = null; string slug = null; string availability = null; otv = webRequest.getRequest(url); if (otv == "err") { return(tovar = null); } name = new Regex("(?<=product_title\">).*?(?=</h1>)").Match(otv).ToString(); article = new Regex("(?<=itemprop=\"sku\">).*?(?=</span>)").Match(otv).ToString(); price = new Regex("(?<=price\":\").*(?=\")").Match(otv).ToString().Replace(".00", ""); availability = new Regex("(?<=<p class=\"stock in-stock\">).*?(?=</p>)").Match(otv).ToString(); if (name.Contains("&")) { name = nethouse.ReplaceAmpersandsChar(name); } slug = chpu.vozvr(name); if (article == "" || article == "--" || article == " " || article == "-" || article == "----") { article = "ur_" + slug; } else { article = "ur_" + article; } article = ReturnArticle(article); price = nethouse.ReturnPrice(Convert.ToDouble(price), 0.02).ToString(); ImagesDownload(otv, article); category = ReturnCategoryTovar(otv); miniText = ReturnDescriptionText(otv); miniText = nethouse.ReplaceAmpersandsChar(miniText); tovar.Add(name); tovar.Add(article); tovar.Add(price); tovar.Add(category); tovar.Add(miniText); tovar.Add(slug); tovar.Add(availability); return(tovar); }
private async Task GetApteka(string search) { await Task.Run(async() => { try { var collection = new CookieDictionary(); var doc = new HtmlDocument(); var req = new HttpRequest { EnableAdditionalHeaders = true, UserAgent = HttpHelper.ChromeUserAgent(), Cookies = collection, ["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", AllowAutoRedirect = true, EnableEncodingContent = true, CharacterSet = Encoding.UTF8, //Proxy = new HttpProxyClient("127.0.0.1", 8888), }; req.AddParam("searchstr", search.ToLower()); req.AddParam("go", "Найти!"); req.AddParam("city", "Киев"); var resp = req.Post("http://medbrowse.com.ua/search").ToString(); if (resp.Contains("http://medbrowse.com.ua/oops/?hash")) { doc.LoadHtml(resp); var postUrl = doc.DocumentNode.Descendants("form") .First() .GetAttributeValue("action", string.Empty); var imgUrl = doc.DocumentNode.Descendants("img").First().GetAttributeValue("src", string.Empty); var imgBytes = req.Get(imgUrl).ToBytes(); await Application.Current.Dispatcher.BeginInvoke(new Action(() => { var captcha = new Captcha(imgBytes); if (captcha.ShowDialog() == true) { req.AddParam("code", captcha.TextResult); resp = req.Post(postUrl).ToString(); } })); } await WebCookies(req.Address.AbsoluteUri, collection); return(new List <AptekaStruct>()); } catch (Exception) { return(new List <AptekaStruct>()); } }); }
public BiliCookie(ILogger <BiliCookie> logger, IOptionsMonitor <BiliBiliCookieOptions> optionsMonitor, IConfiguration configuration) : base(optionsMonitor.CurrentValue.CookieStr) { _logger = logger; _configuration = configuration; _options = optionsMonitor.CurrentValue; CookieStr = _options.CookieStr ?? ""; UserId = _options.UserId ?? ""; BiliJct = _options.BiliJct ?? ""; SessData = _options.SessData ?? ""; OtherCookies = _options.OtherCookies ?? ""; if (_options.DedeUserID.IsNotNullOrEmpty()) { UserId = _options.DedeUserID; } if (_options.Bili_jct.IsNotNullOrEmpty()) { BiliJct = _options.Bili_jct; } if (CookieStr.IsNotNullOrEmpty()) { foreach (var str in CookieStr.Split(';')) { if (str.IsNullOrEmpty()) { continue; } var list = str.Split('=').ToList(); if (list.Count >= 2) { CookieDictionary[list[0].Trim()] = list[1].Trim(); } } } if (CookieDictionary.TryGetValue(GetPropertyDescription(nameof(UserId)), out string userId)) { UserId = userId; } if (CookieDictionary.TryGetValue(GetPropertyDescription(nameof(BiliJct)), out string jct)) { BiliJct = jct; } if (CookieDictionary.TryGetValue(GetPropertyDescription(nameof(SessData)), out string sess)) { SessData = sess; } Check(); }
private void UploadNewProductInB18(CookieDictionary cookie) { System.Threading.Thread.Sleep(20000); string[] naSite1 = File.ReadAllLines("naSite.csv", Encoding.GetEncoding(1251)); if (naSite1.Length > 1) { nethouse.UploadCSVNethouse(cookie, "naSite.csv", tbLogin.Text, tbPassword.Text); } File.Delete("naSite.csv"); nethouse.NewListUploadinBike18("naSite"); }
public static HttpRequest Req(CookieDictionary cookies) { HttpRequest request = new HttpRequest(); request.KeepAlive = true; request.UserAgent = UserAgent; request.Cookies = cookies; request.IgnoreProtocolErrors = true; return(request); }
private async Task WebCookies(string url, CookieDictionary cookie) { await Task.Run(() => { var i = 0; foreach (var pair in cookie.Select(t => cookie.ElementAt(i++))) { InternetSetCookie(url, pair.Key, pair.Value); } Web.Navigate(url); }); }
private void UpdateTovar(string searchTovarInBike, string price, CookieDictionary cookie) { List <string> tovarBike = nethouse.GetProductList(cookie, searchTovarInBike); string priceBike = tovarBike[9].ToString(); if (price != priceBike) { tovarBike[9] = price; nethouse.SaveTovar(cookie, tovarBike); countEdit++; } }
private void UploadTovar() { cookie = nethouse.CookieNethouse(tbLoginNethouse.Text, tbPassNethouse.Text); System.Threading.Thread.Sleep(10000); string[] naSite1 = File.ReadAllLines("naSite.csv", Encoding.GetEncoding(1251)); if (naSite1.Length > 1) { nethouse.UploadCSVNethouse(cookie, "naSite.csv", tbLoginNethouse.Text, tbPassNethouse.Text); } File.Delete("naSite.csv"); nethouse.NewListUploadinBike18("naSite"); }
public static HttpRequest Req(CookieDictionary cookies, string proxy) { HttpRequest request = new HttpRequest(); request.KeepAlive = true; request.UserAgent = UserAgent; request.Cookies = cookies; request.Proxy = ProxyClient.Parse(ProxyType.Http, proxy); request.IgnoreProtocolErrors = true; return(request); }
//Извлекаем кукисы и создаем готовый словарь из них public CookieDictionary Cookies() { string path = "Cookies.txt"; List <string> string_cookies = new List <string>(); //Считываем куки в лист из файла using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default)) { string line; string helpline; while ((line = sr.ReadLine()) != null) { helpline = ""; for (int i = 0; i < line.Length - 1; i++) { if ((line[i] == '=')) { string_cookies.Add(helpline); helpline = ""; i++; } else if (((line[i] == ';') & (line[i + 1] == ' '))) { if ((string_cookies[string_cookies.Count - 1] == "ds_user_id")) { yourid = helpline; } string_cookies.Add(helpline); helpline = ""; i = i + 2; } helpline += line[i]; } } sr.Close(); } //Записываем в кукисловарь CookieDictionary cookies = new CookieDictionary(); for (int i = 0; i < string_cookies.Count - 1; i = i + 2) { if (string_cookies[i] == "csrftoken") { continue; } cookies.Add(string_cookies[i], string_cookies[i + 1]); } cookies.IsLocked = true; return(cookies); }
private bool LoginFBWithCookies() { CookieDictionary admin_cookie = new CookieDictionary(false); admin_cookie.Add("c_user", txtUID.Text); admin_cookie.Add("xs", txtXS.Text); FBGraph.Instance.req.Cookies = admin_cookie; if (Regex.Match(FBGraph.Instance.req.Get("https://mbasic.facebook.com/settings/account/?name", null).ToString(), "name=\"fb_dtsg\" value=\"(.*?)\"").Groups[1].ToString() != "") { updateResult("Đăng nhập thành công!"); return(true); } updateResult("Lỗi, vui lòng đăng nhập lại!"); return(false); }
private void UpdatePrice() { string l = tbLogin.Text; string p = tbPasswords.Text; CookieDictionary cookie = nethouse.CookieNethouse(tbLogin.Text, tbPasswords.Text); if (cookie.Count == 1) { MessageBox.Show("Логин или пароль для сайта введены не верно", "Ошибка логина/пароля"); return; } File.Delete("naSite.csv"); CreateCSV(cookie); }
public CookieInfo(string cookieStr) { CookieStr = cookieStr ?? ""; CookieStrList = CookieStr.Split(";") .Select(x => x.Trim()) .Where(x => x.IsNotNullOrEmpty()) .ToList(); foreach (var item in CookieStrList) { var list = item.Split('='); CookieDictionary.TryAdd(list[0].Trim(), list[1].Trim()); } }
private void btnUpdateImages_Click(object sender, EventArgs e) { countUpdateImage = 0; cookie = nethouse.CookieNethouse(tbLogin.Text, tbPassword.Text); if (cookie.Count == 1) { MessageBox.Show("Логин или пароль введены не верно!", "Ошибка"); return; } UpdateAllImages("https://bike18.ru/products/category/rashodniki-dlya-tehniki"); UpdateAllImages("https://bike18.ru/products/category/zapchasti-dlya-yaponskih-evropeyskih-amerikanskih-motociklov"); MessageBox.Show("Обновленно " + countUpdateImage + "карточек товара"); }
// Загружает ответ и возвращает размер ответа в байтах. internal long LoadResponse(HttpMethod method) { Method = method; Address = _request.Address; HasError = false; MessageBodyLoaded = false; KeepAliveTimeout = null; MaximumKeepAliveRequests = null; _headers.Clear(); _rawCookies.Clear(); if (_request.Cookies != null && !_request.Cookies.IsLocked) Cookies = _request.Cookies; else Cookies = new CookieDictionary(); if (_receiverHelper == null) { _receiverHelper = new ReceiverHelper( _request.TcpClient.ReceiveBufferSize); } _receiverHelper.Init(_request.ClientStream); try { ReceiveStartingLine(); ReceiveHeaders(); RedirectAddress = GetLocation(); CharacterSet = GetCharacterSet(); ContentLength = GetContentLength(); ContentType = GetContentType(); KeepAliveTimeout = GetKeepAliveTimeout(); MaximumKeepAliveRequests = GetKeepAliveMax(); } catch (Exception ex) { HasError = true; if (ex is IOException) { throw NewHttpException(Resources.HttpException_FailedReceiveResponse, ex); } throw; } // Если пришёл ответ без тела сообщения. if (ContentLength == 0 || Method == HttpMethod.HEAD || StatusCode == HttpStatusCode.Continue || StatusCode == HttpStatusCode.NoContent || StatusCode == HttpStatusCode.NotModified) { MessageBodyLoaded = true; } long responseSize = _receiverHelper.Position; if (ContentLength > 0) { responseSize += ContentLength; } return responseSize; }