Holy S#&T

The Good the Bad and the "Needs a helmet"

Google can SUCK IT! .Net 4.0+ C# Screen Scraping Google search results.

Google blows.. so here is how to scrape a Google web search. This is only the C# code behind. It should be easy to implement in a .net 4.0+ forms application.

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()

        private void btn1_Click(object sender, EventArgs e)
            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;
                count = resStream.Read(ResultsBuffer, 0, ResultsBuffer.Length);
                if (count != 0)
                    tempString = Encoding.ASCII.GetString(ResultsBuffer, 0, count);

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

            HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
            html.OptionOutputAsXml = true;
            HtmlNode doc = html.DocumentNode;
            textBox1.Text = sbb;
            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") && hrefValue.ToString().Contains("/url?q=") && hrefValue.ToString().ToUpper().Contains("HTTP://"))
                    int index = hrefValue.IndexOf("&");
                    if (index > 0)
                        hrefValue = hrefValue.Substring(0, index);
                        listBox1.Items.Add(hrefValue.Replace("/url?q=", ""));

The Password to My gmail account


I memorized it using the anagram:
Smily face a ate the tangerien in to zimbabwe nine great games equal quick eXoneration Yankees yank off currly michell lucky seven never ate charlies 3rd weiner reforming xrated hastaged yodeling movies.

Welcome to Holy Shit

First post.. Holy Shit!