You are not logged in.

#1 2018-06-23 23:47:04

ss
Member
Registered: 2018-06-04
Posts: 89

[SOLVED] html mail + mutt + urlscan

I need to extract urls from some html mails. I know it's utterly stupid, but the source doesn't provide any option of plain text mails.
I edit my ~/.muttrc and ~/.config/mutt/mailcap as suggested in http://jasonwryan.com/blog/2012/05/12/mutt/ . The result is very nice. However, urlscan doesn't work correctly, since it tries to parse and extract the original html mail instead of the parsed result by w3m.

If I just copy to text I see in mutt and pipe it to urlscan, it works perfectly. So how can I tell urlscan to work with the parsed messages in plain text?

I have to following setting in my .muttrc, exactly the same as suggested by man urlscan

# urlscan
macro index,pager \cb "<pipe-message> urlscan -c -n<Enter>" "call urlscan to extract URLs out of a message"
macro attach,compose \cb "<pipe-entry> urlscan -c -n<Enter>" "callurlscan to extract URLs out of a message"

Last edited by ss (2018-06-24 00:12:38)

Offline

#2 2018-06-23 23:57:12

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] html mail + mutt + urlscan

See my response here. Other input welcome!

Offline

#3 2018-06-23 23:57:49

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] html mail + mutt + urlscan

Use extract_url with the --list option.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2018-06-24 00:12:15

ss
Member
Registered: 2018-06-04
Posts: 89

Re: [SOLVED] html mail + mutt + urlscan

I have found a solution which works very well for me. I just pipe the raw message to w3m before urlscan.

$ cat ~/.muttrc

# urlscan
macro index,pager \cb "<pipe-message> w3m -I "utf-8" -T text/html | urlscan<Enter>"
macro attach,compose \cb "<pipe-entry> w3m -I "utf-8" -T text/html | urlscan<Enter>"

Apparently, the answer is already in ~/.config/mutt/mailcap, I was too stupid to think of the correlation between them.

$ cat ~/.config/mutt/mailcap

text/html; w3m -I "utf-8" -T text/html; copiousoutput;

Offline

Board footer

Powered by FluxBB