Git Product home page Git Product logo

link_extractor's Introduction

link_extractor

Print a markdown-formatted bullet point with a link to the URL in your clipboard.

The script will also do some smart things to simplify "fancy" urls. More info in the Fanciness Section.

Why?

I have markdown files with links. Things like stories I should read, ones I'd like read later, ones I might recommend to a friend, etc...

Typing them out by hand is boring.

Requires

  • Python >= 3.3
  • BeautifulSoup4
  • Firefox
    • Not an actual requirement, but it will run faster if you use FF.

Usage

My usual pattern is, while reading a story I want to save, copy the url from Firefox, then use vim to open the file I want to add the link to, hit ,k, and the link appears in the line above the cursor.

Example

For example, if I have the following URL in my copy-buffer,

http://stackoverflow.com/questions/3488603/how-do-i-use-tilde-in-the-context-of-paths

then the following line will be added to the file:

  * [How do I use '~' (tilde) in the context of paths? [stackoverflow.com]](http://stackoverflow.com/questions/3488603/how-do-i-use-tilde-in-the-context-of-paths)

Fanciness

The title was too fancy for my liking, so link_extractor changed it from

How do I use '~' (tilde) in the context of paths? - Stack Overflow

to

How do I use '~' (tilde) in the context of paths? [stackoverflow.com]

No more of those pesky dashes!

Another example:

Before defancifying:

Annoyance - Wikipedia, the free encyclopedia

And after:

Annoyance [en.wikipedia.org]

Vim

Here is the relevant .vimrc line:

nmap ,k O<esc>:.!link_extractor<CR>

link_extractor's People

Contributors

sergeio avatar

Stargazers

 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.