Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: HTML Document Comparison

by cbraga (Pilgrim)
on Sep 14, 2000 at 01:25 UTC ( [id://32366]=note: print w/replies, xml ) Need Help??


in reply to HTML Document Comparison

How about that:

1. Read the document and strip off everything except the html tags, including all newlines;
2. Take the MD5 hash of the tag structure;
3. Compare the MD5s of the documents to determine if they have the same structure. Or are derived from the same template with different text.

Advantadges:

* Accounts for markup changes, so differences in the text are not significant;
* If you have a lot of documents, MD5s are easy and quick to compare, as opposed to whole documents.

Disadvantadges:

* Accounts for markup changes, so differences in the text are not significant;
* MD5s are very strict, so there's no telling between small and big differences.

Actually this isn't my idea, it was used in some web survey to count the number of unique sites on the net.

Replies are listed 'Best First'.
RE: Re: HTML Document Comparison
by extremely (Priest) on Sep 14, 2000 at 03:39 UTC

    Yah NetCraft. Which is a great idea, EXCEPT that the changes may be text body within a template. They were looking for templated documents specifically.

    Still, a cool idea worthy of the ++ I stuck on it =)

    --
    $you = new YOU;
    honk() if $you->love(perl)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://32366]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2025-07-08 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.