Random Web Page Grabber
(Replace Google in the following with any suitable portal)
You could take a long list of words (like a spell-checker dictionary), select one word from the list using a random function and then feed that word to Google's "I'm Feeling Lucky" URL (assuming there is an equivalent of www.google.com/search?q=MyWord) and you should end up being redirected to Google's selection of the most appropriate page for that word.
Of course this is not random in the sense of uniformly distributed selection probability of valid URLs, but it returns something that could possibly be adapted to resemble the meaning of random you want. It also (I think) can limit porn exposure if you modify the SafeSearch preference in Google search settings.
As a starting point, this code displays one randomly-selected line from a file (motd.txt) in the style of Message Of The Day:
length=$(wc -l $motd | cut -d " " -f 1)
let "line_number = $RANDOM % $length + 1"
line=$(head -$line_number $motd | tail -1)
If there is an "I'm Feeling Lucky" URL, then compose it using the $line variable containing the randomly selected word or phrase and use wget URL or something similar. For instance, "wget www.google.com/search?q=$line" would download the first page of search results.
EDIT: Apparently, according to http://www.seroundtable.com/archives/015944.html, if you add "&btnI=745" to the end of your web search, then it will do an "I'm Feeling Lucky", but in practice it works with some searches but not with others.
Similar Topics | |
---|---|
Random Discussion - IT version |
Yesterday, 7:49 pm |
Random thing you hate for no particular reason |
Yesterday, 9:55 pm |