المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Asking Google for Pagerank Programatically



C# Programming
09-28-2010, 11:40 AM
This is my version of another guys code (hartertobak) in which he shows us how to use google to get the pagerank. I really liked this code and have really been looking for it BUT there needed to be some modifications to the code before it could be used for batch processing. So i made some simple but effwctive mods to his already beatiful code.

The initial idea was wonderful and worked perfectly if you only wanted to do 1 or 2 URLS but was useless for batches of urls (urls in their thousands) because google will block pagerank requests for sites from the same ip if they have a frequency of less than 1 second (ish) so i had to come up with a way to stop that happening. When i heard of this problem the first thing i did was to put a 10 second sleep between every submission. This meant that google wouldnt pick up this as a bot making the submissions since a human could quite easily make a request to google every 10 seconds.

The next thing after that was to bring in file handling and an interface so that the user could interact with the program. My first idea for this would be to import a .txt file. That way a file could be made and saved for later use and would mean not having to enter the urls one by one. Of course the user could do this but still have the flexibility to add more after it has been loaded.

The HCI is VERY simple and basic. It is a listbox with a few buttons. The listbox is the main display. and the buttons are the controls. There is a textbox for inputting urls and some error handling with the textbox but it is assumed that the user has knowledge of what he/she is doing. every url must begin with http:// and contain at least 1 dot (.)

So now i had a working program but there remains one problem. Time. The 10 second delay cannot be helped but the way i made that happen was to use Thread.Sleep which meant that the program is unresponsive. How do i make my program responsive while waiting those 10 seconds and display the results in real time?

Any help appreciated http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif
jimbo8098