private void getgooglenewsbtn_Click(object sender, EventArgs e) { convertedtxt.Items.Clear(); WebClient webc = new WebClient(); string page = webc.DownloadString("https://news.google.com/?edchanged=1&ned=us&authuser=0"); Todaynewsbrow.Navigate("https://news.google.com/?edchanged=1&ned=us&authuser=0"); //string news = "<span name=\"desc\" class=\"snippet\">(.*?)</span>"; string news = "<div class=\"esc-lead-snippet-wrapper\">(.*?)</div>"; foreach (Match match in Regex.Matches(page, news)) { convertedtxt.Items.Add(match.Groups[1].Value); } btnPlay.PerformClick(); }
private void getbingnewsbtn_Click(object sender, EventArgs e) { convertedtxt.Items.Clear(); WebClient webc = new WebClient(); string page = webc.DownloadString("http://www.bing.com/news/search?q=&nvaug=%5bNewsVertical+Category%3d%22rt_World%22%5d&FORM=NSBABR"); Todaynewsbrow.Navigate("http://www.bing.com/news/search?q=&nvaug=%5bNewsVertical+Category%3d%22rt_World%22%5d&FORM=NSBABR"); //string news = "<span name=\"desc\" class=\"snippet\">(.*?)</span>"; //string news = "<span class=\"st\">(.*?)</span>"; //< span class="snippet" data-tag="" name="desc"> string news = "<span class=\"sn_snip\">(.*?)</span>"; news = "<div class=\"snippet\">(.*?)</div>"; foreach (Match match in Regex.Matches(page, news)) { convertedtxt.Items.Add(match.Groups[1].Value); } btnPlay.PerformClick(); }