Write a script that takes in the url of a play from stdin, such as http://shakespeare.mit.edu/hamlet/full.html, and outputs the number of text characters each play character spoke to stdout, sorted according to who spoke the most.
The play/scene/act titles obviously do not count as dialogue, nor do the character names. Italicized text and [square bracketed text] are not actual dialogue, they should not be counted. Spaces and other punctuation within dialogue should be counted.
(The format for the plays looks very consistent though I have not looked at them all. Tell me if I've overlooked anything. Your script does not have to work for the poems.)
Here is a simulated section from Much Ado About Nothing to show what I expect for output:
More Ado About Nothing
You will never.
LEONATO 15 Messenger 7 BEATRICE 6
This is code golf. The smallest program in bytes will win.