Подскажите почему так долго обрабатывается

biryukovm

Client
Регистрация
19.05.2019
Сообщения
147
Благодарностей
10
Баллы
18
Привет всем.
Я вот не могу понять все сделал в 1 кубике #C но вот классическая обработка занимает около минуты на одной странице
C#:
Tab tab = instance.ActiveTab;
var fl = 0;
var tovar_artikul = tab.FindElementByXPath("//div/input[@name='sku']", 0).GetAttribute("value").Trim();
var tovar_name = tab.FindElementByXPath("//h1", 0).GetAttribute("Innertext").Replace("'", "").Trim();
var tovar_opisanie = tab.FindElementByXPath("//div[contains(@class, 'product_body body')]", 0).GetAttribute("Innertext").Replace("'", "").Trim();
var tovar_statys = tab.FindElementByXPath("//div[contains(@class, 'product_body body')]//strong", 0).GetAttribute("Innertext").Trim();
var tovar_price = tab.FindElementByXPath("//span[@itemprop='price']", 0).GetAttribute("Innertext").Replace(" ", "").Trim();
var tovar_price_star = tab.FindElementByXPath("//div[@class='product_price__old']", 0).GetAttribute("Innertext").Replace("руб.", "").Replace(" ", "").Trim();

var tovar_img = "";
var tovar_p1 = "";
var tovar_p2 = "";
var tovar_p3 = "";
var tovar_p4 = "";
var tovar_p5 = "";
var tovar_p6 = "";
var tovar_p7 = "";
var tovar_p8 = "";
var tovar_p9 = "";
var tovar_p10 = "";
var tovar_p11 = "";
var tovar_p12 = "";
var tovar_p13 = "";
var tovar_p14 = "";
var tovar_p15 = "";
var tovar_p16 = "";
var tovar_p17 = "";
var tovar_p18 = "";
var tovar_p19 = "";
var tovar_p20 = "";
var tovar_p21 = "";
var tovar_p22 = "";
var tovar_p23 = "";
var tovar_p24 = "";
var tovar_p25 = "";


// Разбор параметров
var text_p = "";
HtmlElementCollection tovar_img_file = tab.FindElementsByXPath("//div[contains(@class, 'product_features')]//ul/li"); 
foreach(var el in tovar_img_file){
    fl = 0;
    text_p = "";


    
    if (Obrabotka.megex_match(el.InnerText,"От 2 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 2-х лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 3 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 5 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 6 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"от 7 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 7 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 8 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 9 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 10 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 11 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 12 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 13 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 14 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 16 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"От 18 лет")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Возраст:")=="1"){fl = 1;
        tovar_p1 = el.GetAttribute("Innertext");
    }
    
    

    if (Obrabotka.megex_match(el.InnerText,"Большие пневматические колёса")=="1"){fl = 1;
        tovar_p2 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Большие полиуретановые колёса")=="1"){fl = 1;
        tovar_p3 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Большие полиуретановые полимерные")=="1"){fl = 1;
        tovar_p4 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Большое переднее полиуретановое колесо")=="1"){fl = 1;
        tovar_p5 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Быстрозаряжаемый аккумулятор LG")=="1"){fl = 1;
        tovar_p6 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Быстрые и плавные подшипники")=="1"){fl = 1;
        tovar_p7 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Быстрые и плавные фирменные подшипники")=="1"){fl = 1;
        tovar_p8 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"В наборе:")=="1"){fl = 1;
        tovar_p9 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес гироскутера")=="1"){fl = 1;
        tovar_p10 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес дрифт-карта")=="1"){fl = 1;
        tovar_p11 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес квадроцикла")=="1"){fl = 1;
        tovar_p12 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес продукта")=="1"){fl = 1;
        tovar_p13 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес рипсёрфа")=="1"){fl = 1;
        tovar_p14 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес рипстика")=="1"){fl = 1;
        tovar_p15 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес роликов всего")=="1"){fl = 1;
        tovar_p16 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес роллерсёрфа")=="1"){fl = 1;
        tovar_p17 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес самоката")=="1"){fl = 1;
        tovar_p18 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес тридера")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес шлема")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес электробайка")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес электровелосипеда")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес электромотоцикла")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес электророликов")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес электросамоката")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес электроскейта")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вес:")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Вращения руля на 360 градусов")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Высота руля")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Время полной зарядки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Гарантия")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Герметичный свинцово-кислотный")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Длина деки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Длина самоката")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Длина электроскутера")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Для детей ростом")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Для подростков и взрослых ростом")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"минут непрерывной работы")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"минут непрерывного использования")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"минут непрерывного хода на полной зарядке")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Дорожный просвет (клиренс)")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Ёмкость АКБ")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Запас хода до")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Запатентованная технология")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Запатентованная система")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Запатентованный задний")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Зарядное устройство и")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Изготовлен из")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Изготовлен на")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Колеса из полиуретана")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Комплектация:")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Компрессионная система")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Литий-ионный аккумулятор LG")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Максимальная высота руля от деки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Максимальная высота руля от земли")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Максимальная скорость")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Максимальня нагрузка")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Минимальная высота руля от деки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Минимальная высота руля от земли")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Мощность мотор-колеса")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Наклон руля")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Настраиваемое положение руля")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Не требует сборки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Не требует сервисного обслуживания")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Общая длина самоката")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Обхват головы")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Патентованный складной механизм")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Переменная скорость")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"По опыту наших покупателей подходит детям")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит детям и взрослым ростом")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит детям и подросткам ростом")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит детям от")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит детям ростом от")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит для детей и взрослых ростом от")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит для детей и взрослых, ростом от")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит для самоката")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит под рост от")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подходит под самокат")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }   
    if (Obrabotka.megex_match(el.InnerText,"Подшипники RZR")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Подшипники ABEC-5")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Полезная длина деки (место для ног)")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Полезная длина деки (платформа для ног)")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Полиуретановые колёса")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Прочный руль из авиационного алюминия шириной")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер L")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер S")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер XL")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер М")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер: S")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер скейта")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размер чехла")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размеры продукта:")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размеры руля:")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размеры самоката")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размеры упаковки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размеры электробайка")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Размеры электро-квадроцикла")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Разработан и используется командой RAZOR")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Резиновые колеса с алюминиевым диском")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Руль Y формы")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Ручной передний тормоз")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Складной механизм")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Складывается и раскладывается")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Тихий надежный электромотор")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Тихий надёжный электромотор")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Тройной хомут")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Угол руля")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Удобные мягкие грипсы")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Уретановые колеса")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Фиксированная высота руля")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Ширина деки")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Ширина платформы для ног")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Ширина руля")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Широкая дека")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Яркий дизайн")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Рекомендуемая нагрузка до")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Максимальная нагрузка")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Плавная регулировка газа")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"запуск двигателя через отталкивание ногой")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Индикация уровня заряда")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Двойной тормоз:")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Регулировка руля по высоте во всём его диапазоне")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Современные эргономичные удобные резиновые ручки на руле")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Дополнительная шайба в рулевой колонке, для уменьшения люфта в рулевой системе")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Полноценный большой тормоз-крыло, который защищает от грязи и брызг")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Удобная подножка для парковки самоката")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Требуется частичная сборка")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    if (Obrabotka.megex_match(el.InnerText,"Возможность полноценного использования в виде обычного городского самоката, без применения электропривода")=="1"){fl = 1;
        tovar_p19 = el.GetAttribute("Innertext");
    }
    
    
    



    
    
    
    if (fl==0){
        project.SendInfoToLog("---"+el.GetAttribute("Innertext"),true);
        project.Lists["list"].Add(el.GetAttribute("Innertext"));
    }
}



HtmlElementCollection tovar_img_l = tab.FindElementsByXPath("//div[contains(@class, 'image_to_float')]"); 
    foreach(var a in tovar_img_l){
        tovar_img = tovar_img +" | "+ a.GetAttribute("style").Replace("background-image: url(", "").Replace("display:none;", "").Replace(");", "");
        project.Lists["tovar_img"].Add(a.GetAttribute("style").Replace("background-image: url(", "").Replace("display:none;", "").Replace(");", ""));
}
    
var tovar_video = tab.FindElementByXPath("//input[@class='video_string']", 0).GetAttribute("value").Trim();
Проблему я как заметил в этом моменте (чем их меньше тем быстрее)

C#:
if (Obrabotka.megex_match(el.InnerText,"*****")=="1"){fl = 1;
Вот функция этой обработки
C#:
        public static string megex_match(string text,string poisk){
            string poisk2 = poisk;
            //string poisk2 = poisk.Replace("(", "\(");
            if (new Regex(poisk2).Match(text).Value.Trim() == poisk){
                return "1";
            }else{
                return "0";
            }
            
        }

Также подскажите как сделать замену в тексте функции с помощью Replace - я эту строку закомментировал так как ругается
 

Phoenix78

Client
Read only
Регистрация
06.11.2018
Сообщения
11 790
Благодарностей
5 690
Баллы
113
.GetAttribute очень долго выполняется. Ну вот прям нереально долго. я так понял это из-за обращения к инстансу.
Я для себя решил эту проблему в виде уменьшения обращения к инстансу. Получаю DOM в текстовую переменную и использую ZennoPoster.Parser.ParseByXpath . у этой функции есть перегрузка , где 1-й входной параметр можно задать строку. Выполняется мгновенно.

ругается на управляющие символы в строке. надо принудительно указать текст. вот так.
C#:
string poisk2 = poisk.Replace(@"(", @"\(");
 

biryukovm

Client
Регистрация
19.05.2019
Сообщения
147
Благодарностей
10
Баллы
18
Получаю DOM в текстовую переменную и использую ZennoPoster.Parser.ParseByXpath . у этой функции есть перегрузка
Можно пожалуйста примеры кода, в цыкле и без, работа с переменной и с instance.ActiveTab
А то как не запущу код показывает пропущен атрибут сижу и голову ломаю

И не будет ли трудно Вам подсказать этот момент https://zennolab.com/discussion/threads/sdelat-zamenu-na-pustotu-cherez-regex.77049/
Не получается сделать замену через Regex
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)