Giter Site home page Giter Site logo

urlscan's Introduction

Urlscan

Contributors

Daniel Burrows <[email protected]> (Original Author)

Scott Hansen <[email protected]> (Maintainer)

Maxime Chatelle <[email protected]> (Debian Maintainer)

Purpose and Requirements

Urlscan is a small program that is designed to integrate with the "mutt" mailreader to allow you to easily launch a Web browser for URLs contained in email messages. It is a replacement for the "urlview" program.

Requires: Python 2.6+ (including Python 3.x) and the python-urwid library

Features

Urlscan parses an email message or file and scans it for URLs and email addresses. It then displays the URLs and their context within the message, and allows you to choose one or more URLs to send to your Web browser. Alternatively, it send a list of all URLs to stdout.

Relative to urlview, urlscan has the following additional features:

  • Support for emails in quoted-printable and base64 encodings. No more stripping out =40D from URLs by hand!
  • The context of each URL is provided along with the URL. For HTML mails, a crude parser is used to render the HTML into text. Context view can be toggled on/off with c.
  • URLs are shortened by default to fit on one line. Viewing full URL (for one or all) is toggled with s or S.
  • Jump to a URL by typing the number.
  • Incremental case-insensitive search with /.
  • Execute an arbitrary function (for example, copy URL to clipboard) instead of opening URL in a browser.
  • Configure colors via ~/.config/urlscan/config.json. Generate default config file for editing with P. Cycle through available palettes with p.

Installation and setup

To install urlscan, install from your distribution repositories, from Pypi, install the Archlinux Package , or install from source using setup.py.

Note

To work with Python 3.x the minimum required version of urwid is 1.2.1. Python 2.x needs urwid >= 1.1.0

Once urlscan is installed, add the following lines to your .muttrc:

macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"

macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"

Once this is done, Control-b while reading mail in mutt will automatically invoke urlscan on the message.

To choose a particular browser, set the environment variable BROWSER. If BROWSER is not set, xdg-open will control which browser is used, if it's available.:

export BROWSER=/usr/bin/epiphany

Command Line usage

urlscan [-n, --no-browser] [-c, --compact] [-d, --dedupe] [-r, --run <expression>] <file>

Urlscan can extract URLs and email addresses from emails or any text file. Calling with no flags will start the curses browser. Calling with '-n' will just output a list of URLs/email addressess to stdout. The '-c' flag removes the context from around the URLs in the curses browser, and the '-d' flag removes duplicate URLs. Files can also be piped to urlscan using normal shell pipe mechanisms: cat <something> | urlscan or urlscan < <something>

Theming

Press 'P' from urlscan to generate ~/.config/urlscan/config.json with the default color and black & white palettes. This can be edited or added to, as desired. The first palette in the list will be the default. Configure the palettes according to the Urwid display attributes.

Known bugs and limitations

  • Running urlscan sometimes "messes up" the terminal background. This seems to be an urwid bug, but I haven't tracked down just what's going on.
  • Extraction of context from HTML messages leaves something to be desired. Probably the ideal solution would be to extract context on a word basis rather than on a paragraph basis.
  • The HTML message handling is a bit kludgy in general.
  • multipart/alternative sections are handled by descending into all the sub-parts, rather than just picking one, which may lead to URLs and context appearing twice. (Bypass this by selecting the '--dedupe' option)

urlscan's People

Contributors

arvedui avatar firecat53 avatar kylescottmcgill avatar machinedgod avatar marvinthepa avatar mgedmin avatar mrbussy avatar msmith491 avatar truls avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.