Random web page?
Terry Hancock
hancock at anansispaceworks.com
Thu Apr 17 13:49:07 EDT 2003
Peter Hansen wrote:
> 1. Generate random IP addresses. Easiest way is using an integer
> which is converted to a net address using tools in "socket".
>
> 2. Try connecting on port 80.
>
> 3. If there's something there, display it and you're done. Else loop.
>
> Now if you consider that a starting point, for discussion, what
> part of it doesn't serve your purpose, and why?
This easily sounds like the closest one can get to a real answer, but I do
have one question -- what about virtual hosting? Aren't a large number of
websites set up to share IPs using name-based resolution nowadays.
I actually know little about how this is used on the web, but I have Apache
configured on my testing server to deliver different sites for the same IP
based on the domain name requested (this is on my LAN). I figure it's
probably used a lot, especially for personal web pages and the like.
Perhaps one can query the DNS registry in some way that would be more
equal? Can RARP be used to look up *all* domains associated with an IP, or
only one canonical value? If you could look up all of them, you could then
select one at random -- but this will not generate evenly weighted results
of course.
You *could* make an effort to record look-ups that resulted in large
numbers of domains to give them more weight in the future. But this would
be expensive, and you'd probably have to run for a *long* time for it to
become relevant.
Of course, the distribution is probably not too relevant -- there are so
many web pages in the world now, that you are unlikely to retrieve the same
one twice with any truly random system. (Not true on Google, where
connectivity highly biases the search).
I know there's an X screensaver that does something like this to retrieve
random images. I doubt they were too concerned about even distribution,
though.
Cheers,
Terry
--
Terry Hancock
Anansi Spaceworks http://www.AnansiSpaceworks.com/
More information about the Python-list
mailing list