protected void spider_theverge_com_Click(object sender, EventArgs e) { try { Spiders spider = new Spiders(); Global_collection collection_news = new Global_collection(); collection_news.add(spider.theverge_com()); var list = collection_news.get(); text = ""; foreach (var element in list) { //Debug.WriteLine("element.type); text += "id = " + element.id.ToString() + "\n"; text += "type = " + element.type + "\n"; text += "sourse = " + element.source + "\n"; text += "title = " + element.title + "\n"; text += "content = " + element.content + "\n"; text += "image = " + element.image + "\n"; text += "\n"; Debug.WriteLine(text); } Output_new.Text = text; update(); Label.Text = "Робота бота завершена."; } catch (Exception ex) { Label.Text = "Вызвано исключение: " + ex.Message; } }
protected void theverge_com_inXml_Click(object sender, EventArgs e) { try { Spiders spider1 = new Spiders(); Global_collection collection_news = new Global_collection(); collection_news.add(spider1.theverge_com()); collection_news.toXml(); collection_news.toTxt(); Label.Text = "Работа бота прошла успешно! файл сахранен в директори output"; } catch (Exception ex) { Label.Text = "Вызвано исключение: " + ex.Message; } }
// GET: api/values public List <object_news> Get() { try { Spiders spider = new Spiders(); Global_collection collections = new Global_collection(); collections.add(spider.theverge_com()); return(collections.getList()); } catch { Global_collection collections = new Global_collection(); collections.readXml(); return(collections.getList()); } }