<<< Date Index >>>     <<< Thread Index >>>

Re: URLs screwed in the mail body



On Saturday, March  8 at 11:15 AM, quoth Kyle Wheeler:
Yeah... unfortunately, that macro (I've been trying it all yesterday) doesn't *quite* work on all emails. Lynx sometimes gets confused by the message headers, I think.

I just put together a perl script that would do the trick instead of lynx. It's attached.

I realized that my perl script didn't handle format=flowed emails (much less format=flowed delsp=yes emails, which my family uses a lot). Attached is a better script that DOES handle it. So far so good. Here's how you can use it:

    unset pipe_decode
    macro index \cb "<pipe-message>~/extract_url.pl | urlview<enter>"

It uses perl's MIME::Parser module to decode email, then uses HTML::Parser module (if necessary) to peel out urls from html. There doesn't seem to be a good format=flowed handler in perl, and I was lazy about peeling out urls, so it just concatenates all flowed lines into long lines (obeying the format=flowed rules) and spits them out---urlview should be able to handle peeling the urls from that.

The end goal, which I think it achieves, is to ensure that all URLs are easily found by urlview and aren't wrapped or clipped or mangled in some other way.

Suggestions or opinions are appreciated. :)

~Kyle
--
Seeing a murder on television . . . can help work off one's antagonisms. And if you haven't any antagonisms, the commercials will give you some.
                                                   -- Alfred Hitchcock

Attachment: extract_url.pl
Description: Perl program

Attachment: pgpEQeyLa4PCO.pgp
Description: PGP signature