I am an old programmer now making my return - old habits die hard
I used to work with C++ under Linux but haven't programmed in a few years since moving more to design and management. However, have a business idea I want to try out.
I am looking to crawl a specific website and all its sub-domains and trawl it for keywords, and do a count of the occurrence of that word under the domain, and store the result in a database.
For example , consider IBM's portal (a massive website), and I want to check how many webpages have the word "ThinkPad".
I have no idea where to start. Should I be looking at things like GNU Wget , Abot or what? Or, am I looking at writing a search engine? When you enter a word in google - it tells you the number of results and the time like "2,999 in 0.003second".
In simpleton terms - like running a command line to do a grep on a list of files and piping it into a wc (word count) - except i want to run it on a website and all its domains and files. I would like to be able to define my criteria in an XML file or rules file - something i can enhance and manipulate over time.
You'd have a class which takes a URL and downloads the page, counts the number of times the search string appears, and scans the downloaded page for URLs. For every URL that it finds, it creates a new instance and the cycle starts over again. Personally I would have each new instance spawn in a new thread (with a maximum number of threads), and I'd store the URLs already visited so that no URL would be downloaded or parsed twice.
Sort off. Is there a way to actually search the pages without actually downloading them? I assume I can like put the downloaded file in a buffer, search it, then wipe my buffer so I don't end up downloading the entire website. But that could use up my memory and webpages today no longer respect the 1024 bit (or was it something like that) where the size of the page doesn't crash the web browser. Surely no webpage would be bigger than a few MBs but I am not sure how expensive the search would be if you're downloading and searching many pages in parallel.
Google has farms and are indexing a bazillion keywords. Am not doing that - I just need specific keywords that are targeted.
In linux terms, if the file on a crawled website is not 'touched' then the bot skips it. So in theory, the size of the crawled web is elastic - i.e. once you've crawled a page you don't actually crawl it unless its changed. So in theory, I am not re-running the crawler on the entire domain every time because the search itself is expensive.