public List <NewsModel> Update() { Task task = new Task(() => { try { ParserWorker <NewsModel[]> parserWorker1 = new ParserWorker <NewsModel[]>(new LinkParser()); parserWorker1.Settings = new NewsSettings(1, 5); parserWorker1.OnNewData += (e, x) => { foreach (var i in x) { list.Add(i); } IsComplited = true; }; parserWorker1.Start(); } finally { } }); task.Start(); while (true) { if (IsComplited == true) { return(list); } } }
string GetName(object arg1, string post) { ParserWorker<string> parser; parser = new ParserWorker<string>(new SiteParser()); parser.OnNewData += Parser_OnNewData; }
public AboutPage() { InitializeComponent(); phone = new Book { bookId = "31249554", Title = "", imgUrl = "ozon-st.cdn.ngenix.net/multimedia/1022948366.jpg" }; BindingContext = this; parser = new ParserWorker <string[]>( new OzonParser() ); parser.OnCompleted += Parser_OnCompleted; parser.OnNewData += Parser_OnNewData; // string html = @"<!DOCTYPE html> //<html> //<body> //<h2>HTML Image Parsing</h2> //<img src='https://www.w3schools.com/html/img_girl.jpg' alt='Girl in a jacket' width='500' height='600'> //</body> //</html> "; // var url = "https://oilprice.com/oil-price-charts#prices"; // var web = new HtmlWeb(); // var htmlDoc = web.Load(url); // myImage.Source = HtmlParsing(html); // myLabel.Text = HtmlParsing(url); }
private void buttonChecking_Click(object sender, EventArgs e) { siteObject = ListSites.GetSite(GetLink); if (siteObject == null) { return; } dataGridView1.Rows.Clear(); ChekEnable = false; ParserWorker <string[]> parserImg = new ParserWorker <string[]>( siteObject.CreatParserGetMainImg(), new HabraSettings(GetLink, "") ); parserImg.OnNewData += Parser_OnNewDataImg; parserImg.OnError += ParserImg_OnError; parserImg.Start(); ParserWorker <Chapter[]> parser = new ParserWorker <Chapter[]>( siteObject.CreatParserGetChapters(), new HabraSettings(GetLink, siteObject.LinkToChapterList) ); parser.OnNewData += Parser_OnNewDataChapter; parser.OnError += Parser_OnError; parser.Start(); }
public MainForm() { InitializeComponent(); FormBorderStyle = FormBorderStyle.FixedSingle; //Настройка парсера parser = new ParserWorker <ItemModel[]>(new RssFeedParser()) { Settings = new RssFeedParserSettings() }; parser.OnCompleted += Parser_OnComlpeted; parser.OnNewData += Parser_OnNewData; parser.OnOpenLink += Parser_OnOpenLink; parser.OnDescription += Parser_OnDescription; //Установка параметров таймера timer.Interval = Properties.Settings.Default.Timer; timer.Tick += new EventHandler(timer_Tick); currRssFeed = parser.Settings.BaseUrl; currTimerSettings = Properties.Settings.Default.Timer; }
public Form1() { InitializeComponent(); parser = new ParserWorker <string[]>(new HabraParser()); parser.OnNewDataRef += Parser_OnNewDataRef; parser.OnNewData += Parser_OnNewData; }
private void ButtonStart_Click(object sender, EventArgs e) { switch (ComboBoxSites.SelectedItem.ToString()) { case "Habra": parser = new ParserWorker <string[]>(new HabraParser()); parser.Settings = new HabraSettings((int)NumericStart.Value, (int)NumericEnd.Value); break; case "Kino": parser = new ParserWorker <string[]>(new KinoParser()); parser.Settings = new KinoSettings(1, 1); break; case "Vk": parser = new ParserWorker <string[]>(new VkParser()); parser.Settings = new VkSettings(1, 1, TextBoxId.Text); break; default: parser = new ParserWorker <string[]>(new HabraParser()); parser.Settings = new HabraSettings((int)NumericStart.Value, (int)NumericEnd.Value); break; } parser.OnCompleted += Parser_OnComplited; parser.OnNewData += Parser_OnNewData; parser.Start(); }
private void LinkParser_OnCompleted(object arg1, List <string> arg2) { var currentSettings = ((ParserWorker <List <string> >)arg1).Settings; if (currentSettings.LinkDeep > 1) { startParsing(new ParserSettingLink() { LinkDeep = currentSettings.LinkDeep - 1, Url = currentSettings.Url }); } foreach (var link in arg2) { var url = link; if (!IsValidUrl(link)) { url = currentSettings.Url + link; } var textSetting = new ParserSettingLink() { Url = url }; textParser = new ParserWorker <string>(new TextParser(), textSetting); textParser.Start(); textParser.OnCompleted += TextParser_OnCompleted; } }
private void LoadInternet(object sender, RoutedEventArgs e) { if (isRunning || listCollection != null) { if (parser.IsActive) { parser.Abort(); } listAbiturient.ItemsSource = null; listCollection.Clear(); listab.Clear(); listTarget.Clear(); listSpecial.Clear(); } else { listCollection = new List <Abiturient>(); listab = new List <Abiturient>(); listTarget = new List <Abiturient>(); listSpecial = new List <Abiturient>(); } currentPage = 1; parser = new ParserWorker <string[]>(new VuzParser()); parser.OnNewData += Parser_OnNewData; parser.Settings = new VuzSettings(startPage, int.Parse(endPageTB.Text)); parser.Settings.BaseUrl = linkTB.Text; parser.Start(); isRunning = true; }
public Form1() { InitializeComponent(); parser = new ParserWorker <string[]>(new HabraPrser()); parser.OnCompleted += Parser_OnComplited; parser.OnNewData += Parser_OnNewData; }
//получаем новые новости static void Get2chNews(object obj) { ParserWorker <string[]> parser = (ParserWorker <string[]>)obj; Console.WriteLine("..:: Обновление новостей ::..\n" + DateTime.Now.ToLongTimeString()); parser.Start(); }
public NewBookEdit() { Title = "ДОБАВЛЕНИЕ КНИГИ"; InitializeComponent(); book = new Book { BookTitle = "", BookAuthor = "", BookCategory = "", BookDescription = "", ISBNnumber = "", BookImagePath = "icon.png" }; BindingContext = this; CategoryList = new ObservableCollection <Category>(app.Database.GetCategories().ToList()); book_category.ItemsSource = CategoryList; parser = new ParserWorker <string[]>(new OzonParser()); parserIsbn = new ParserWorker <string[]>(new AmazonParser()); parser.OnCompleted += Parser_OnCompleted; parser.OnNewData += Parser_OnNewData; parserIsbn.OnCompleted += Parser_OnCompleted; parserIsbn.OnNewData += Parser_OnNewData; // book_isbn.Text = "9785941575381"; if (OzonBookId.Text != null) { ButtonStart_Click(this, EventArgs.Empty); parser.Settings = new OzonSettings(OzonBookId.Text); parser.Start(); } }
//получаем новые новости static void GetNewsUpdate(object obj) { ParserWorker <string[]> parser = (ParserWorker <string[]>)obj; Console.WriteLine("..:: Обновление контента ::..\n" + DateTime.Now.ToLongTimeString()); parser.Start(); }
public DatabaseParserUpdater() { parser = new ParserWorker <Match[]>(new MatchParser(), new MatchSettings()); list = new List <MatchEntity>(); leagues = Available.Leagues.ToArray(); coeffs = new List <CoeffEntity>(); parser.OnNewData += (matches, league) => { foreach (var match in matches) { MatchEntity row = new MatchEntity(); row.StartTime = match.StartTime; row.Teams = match.Teams; row.League = league; foreach (var coeff in match.Coeffs) { CoeffEntity item = new CoeffEntity(); item.Coefficient = coeff.Value; item.Formula = coeff.Formula; item.Holder = row; coeffs.Add(item); } list.Add(row); } }; }
public FormMain() { InitializeComponent(); parser = new ParserWorker <string[]>(new AvitoParser()); parser.OnCompleted += Parser_OnCompleted; parser.OnNewData += Parser_OnNewData; }
public Form1() { InitializeComponent(); parser = new ParserWorker <List <FreelanceTask> >(new FreelanceParcer(), new FreelanceSettings()); parser.onNewData += Parser_onNewData; parser.OnCompleted += Parser_OnCompleted; }
public Form1() { InitializeComponent(); //parser = new ParserWorker<string[]>(new BankParser()); parser = new ParserWorker <ExchangeRates[]>(new BankParser()); parser.OnComplite += Parser_OnComplite; parser.OnNewData += Parser_OnNewData; }
public MainWindow() { InitializeComponent(); parser = new ParserWorker <AvitoNote[]>(new AvitoParser()); parser.OnComleted += Parser_OnComleted; parser.OnNewData += Parser_OnNewData; }
public Form1() { parser = new ParserWorker <string[]>(new WorkParser()); InitializeComponent(); parser.OnComplete += Parser_OnComplete; parser.OnNewData += Parser_OnNewData; }
public Form1() { InitializeComponent(); parser = new ParserWorker <HabrModel[]>(new HabrParserObject()); parser.OnNewData += Parser_OnNewData; parser.OnParseCompleted += Parser_OnParseCompleted; }
/// <summary> /// Start VisualCron parser /// </summary> /// <param name="startPoint">Start point. For example: page id</param> /// <param name="endPoint">End point. For example: page end id</param> /// <param name="threadCount">Parse thread count</param> private static void StartVC(int startPoint, int endPoint, int threadCount = 1) { ParserWorker <VisualCronModel> worker = new ParserWorker <VisualCronModel>(new VisualCronParser(), new VisualCronParserSettings(startPoint, endPoint, threadCount)); worker.OnCompleted += Worker_OnCompleted; worker.OnNewData += Worker_OnNewData; worker.OnPageCompleted += Worker_OnPageCompleted; worker.Start(); }
public MainWindow() { InitializeComponent(); parser = new ParserWorker <string[]>( new OsParser() ); parser.OnCompleted += Parser_OnCompleted; parser.OnNewData += Parser_OnNewData; }
public MainForm() { InitializeComponent(); _parser = new ParserWorker <string[]>( new ElectronshikParser() ); _parser.OnCompleted += Parser_OnCompleted; _parser.OnNewData += Parser_OnNewData; }
public FormWorker() { parser = new ParserWorker <string[]>( new HabraParser() ); parser.OnCompleted += Parser_OnCompleted; parser.OnNewData += Parser_OnNewData; }
public void Get() { ParserWorker <string> Parser; Parser = new ParserWorker <string>(new EstoreParser()); Parser.OnNewData += Parser_OnNewData; Parser.Settings = new EstoreSettings(); Parser.Start(); }
public Form1() { InitializeComponent(); parserMP = new ParserWorker <string[]>( new MainPageParser() ); parserMP.OnComplited += Parser_OnCompleted; parserMP.OnNewData += Parser_OnNewDataMP; }
static public IEnumerable <BaseExchanger> Run() { ParserWorker <BaseExchanger[]> worker = new ParserWorker <BaseExchanger[]>(new SiteParser(), addresses); worker.OnNewData += Parse_OnNewData; worker.OnCompleted += Parse_OnCompleted; worker.Start(); return(exchangers); }
public MainForm() { InitializeComponent(); parser = new ParserWorker <List <string> >( new SiteParser()); parser.OnCompleted += Parser_OnCompleted; parser.OnNewData += Parser_OnNewData; }
public override async void Execute(Message message, TelegramBotClient client) { parser = new ParserWorker <string[]>(new AvitoParser()); parser.Settings = new AvitoSettings(1, 5); parser.Start(); parser.OnNewData += Parser_OnNewData; Thread.Sleep(5000); await client.SendTextMessageAsync(message.Chat.Id, temp); }
public async Task <ActionResult> ParseStart() { int start = 1; int end = 1; if (Request.Params["start"] != null) { start = Int32.Parse(Request.Params["start"]); } if (Request.Params["end"] != null) { end = Int32.Parse(Request.Params["end"]); } List <Product> newProductsList = new List <Product>(); ParserWorker <List <Product> > parser = new ParserWorker <List <Product> >( new SiteParser(), new SiteSettings(start, end) ); for (int i = parser.Settings.StartPoint; i <= parser.Settings.EndPoint; i++) { var source = await parser.Loader.GetSourceByPageId(i); var domParser = new HtmlParser(); var document = await domParser.ParseAsync(source); var result = parser.Parser.Parse(document); newProductsList.AddRange(result); } foreach (var product in newProductsList) { Product matches = db.Products.FirstOrDefault(p => p.Name == product.Name); if (matches == null) { string imgPath = parser.Settings.BaseUrl + product.ImgUrl; string fileName = System.IO.Path.GetFileName(imgPath); string newPath = Server.MapPath("~/Images/Catalog/") + System.IO.Path.GetFileName(fileName); await FilesLoader.DownloadFileAsync(imgPath, newPath); product.ImgName = fileName; db.Products.Add(product); } } await db.SaveChangesAsync(); return(RedirectToAction("Index")); }