https://github.com/wesleyac/topen
A small script to open links on the command line
https://github.com/wesleyac/topen
Last synced: 12 months ago
JSON representation
A small script to open links on the command line
- Host: GitHub
- URL: https://github.com/wesleyac/topen
- Owner: WesleyAC
- License: mit
- Created: 2016-07-12T05:07:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-14T04:52:32.000Z (almost 10 years ago)
- Last Synced: 2025-07-14T20:37:25.054Z (12 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# topen
[](https://github.com/WesleyAC/topen/blob/master/LICENSE)
`topen` is a small script to open links on the command line. It's designed to be able to view multimedia content (images, videos, gifs, etc) without the overhead of a web browser. `topen` is designed to be used with [rtv](https://github.com/michael-lazar/rtv), but could be useful in other contexts as well.
# How it works
`topen` itself is a very small python script that has a list of regular expressions describing urls, along with a script to deal with the url. Because of this, it's very easy to extend: just add another script to the helpers directory, along with a regexp of sites that it should apply to.
# Supported sites
The default browser is `w3m`. However, there is explicit support for the following sites and cases:
| Site | Notes |
| -------------- | ------------------------------------------------- |
| Any image link | |
| Any mp4 file | |
| Imgur | Works with gifvs, single images, and albums |
| Gfycat | Any gfycat link |
# Dependencies
| Dependency | Reason |
| ---------------- | ----------------------- |
| `python` | Main script |
| `w3m` | Default browser |
| `curl` | Download images/videos |
| `feh` | Display images |
| `mplayer` | Display videos |
| `youtube-dl` | Download youtube videos |
| Beautiful Soup 4 | Download imgur albums |
# Use with `rtv`
In order to have `topen` play nice with `rtv`, the `$DISPLAY` environment variable must be set to something that evaluates as false. I use the following alias:
```
alias rtv='export DISPLAY="";rtv'
```
`topen` will try to autodetect the `$DISPLAY` variable and set it back before running any handler scripts.
# Contributing
If you find a site that might benefit from having a script for it, submit an issue with the name of the site (and ideally some example links). Or, even better, submit a PR!