Created
July 13, 2023 19:53
-
-
Save w0ltage/171ca644888697fce9abdd66f323f654 to your computer and use it in GitHub Desktop.
linkhandler for RSS feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Inspired by https://youtu.be/VfKpftzaSJ4 | |
# required dependencies: | |
# yt-dlp - https://github.com/yt-dlp/yt-dlp | |
# qutebrowser - https://qutebrowser.org | |
# rdrview - https://github.com/eafer/rdrview | |
# zathura, mpv, xclip, sxiv | |
# Feed script a url or file location. | |
# If an image, it will view in sxiv, | |
# if a video or gif, it will view in mpv | |
# if a music file or pdf, it will download, | |
# otherwise it opens link in browser. | |
if [ -z "$1" ]; then | |
url="$(xclip -o)" | |
else | |
url="$1" | |
fi | |
case "$url" in | |
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) | |
yt-dlp --quiet $url -o - | mpv --quiet - -force-seekable=yes >/dev/null 2>&1 & ;; | |
*png|*jpg|*jpe|*jpeg|*gif) | |
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; | |
*pdf|*cbz|*cbr) | |
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; | |
*) | |
rdrview "$url" -B 'qutebrowser -s "content.user_stylesheets" "~/.config/newsboat/style.css"' >/dev/null 2>&1 & | |
esac | |
# Content of "style.css" | |
# body { | |
# max-width: 1100px; | |
# margin: auto; | |
# padding: 2%; | |
# background-color: #171616; | |
# color: #c5c4c4; | |
# } | |
# | |
# a { | |
# color: #c5c4c4; | |
# } | |
# | |
# img { | |
# max-width: 600px; | |
# max-height: 100%; | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment