get links from search engines in c#
<p>first of all excuse me for my broken english<br>
i want to code a metasearch engine
first i try to use google bing and yahoo api s but theye were limited<br>
then i'm trying to use htmlagility pack to gain results link of search engines<br>
i have this code</p>

<pre><code>using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.ServiceModel.Syndication;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;

namespace Search
{
public partial class Form1 : Form
{
    // load snippet
    HtmlAgilityPack.HtmlDocument htmlSnippet = new HtmlAgilityPack.HtmlDocument();

    public Form1()
    {
        InitializeComponent();
    }

    private void btn1_Click(object sender, EventArgs e)
    {
        listBox1.Items.Clear();
        StringBuilder sb = new StringBuilder();
        byte[] ResultsBuffer = new byte[8192];
        string SearchResults = "http://google.com/search?q=" + txtKeyWords.Text.Trim();
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SearchResults);
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        Stream resStream = response.GetResponseStream();
        string tempString = null;
        int count = 0;
        do
        {
            count = resStream.Read(ResultsBuffer, 0, ResultsBuffer.Length);
            if (count != 0)
            {
                tempString = Encoding.ASCII.GetString(ResultsBuffer, 0, count);
                sb.Append(tempString);
            }
        }

        while (count &gt; 0);
        string sbb = sb.ToString();

        HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
        html.OptionOutputAsXml = true;
        html.LoadHtml(sbb);
        HtmlNode doc = html.DocumentNode;

        foreach (HtmlNode link in doc.SelectNodes("//a[@href]"))
        {
            //HtmlAttribute att = link.Attributes["href"];
            string hrefValue = link.GetAttributeValue("href", string.Empty);
            if (!hrefValue.ToString().ToUpper().Contains("GOOGLE") &amp;&amp; hrefValue.ToString().Contains("/url?q=") &amp;&amp; hrefValue.ToString().ToUpper().Contains("HTTP://"))
            {
                int index = hrefValue.IndexOf("&amp;");
                if (index &gt; 0)
                {
                    hrefValue = hrefValue.Substring(0, index);
                    listBox1.Items.Add(hrefValue.Replace("/url?q=", ""));
                }
            }
        }
    }
}
</code></pre>

<p>}</p>

<p>can i use this code for all search engines?
i changed these lines so it work for other search engines 

<pre><code>if (!hrefValue.ToString().ToUpper().Contains("YAHOO") &amp;&amp; hrefValue.ToString().Contains("/url?q=") &amp;&amp; hrefValue.ToString().ToUpper().Contains("HTTP://"))
</code></pre>

<p>and <br></p>

<pre><code>string SearchResults = "http://yahoo.com/search?q=" + textBox1.Text.Trim();
</code></pre>

<p>but it dosent work<BR></p>

<p>My other problem is that this code just return the first page links .what should i do if i want to return N first link?
<br>
anybody can help?</p>