I am currently in a phase where I try to collect every newsfeed together as rss in my terminal newsreader newsboat. I recently saw on the internet how you can get your subreddits you want as an RSS feed: "https://reddit.com/r/NAME/.rss".

Now I was in the position, that I still had to open the browser to open actual media like images or videos. In the newsboat doc I found the command pipe-to.

So I wrote a little script which I just could pipe the whole article in and download, and open the media.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#!/bin/sh
DIR="/tmp/reddit/"
mkdir -p $DIR
while read -r line
do
    link=$(echo "$line" | grep -oh "https://[iv]\.redd\.it/.* ")
    [ -z "$link" ] && continue
    filename=$(echo $link | awk ' BEGIN { FS = "/"}; {print $4}')
    filename="$DIR$filename"
    curl $link --output $filename
    # o is a script, which chooses the right application for a file by the extension, stolen from Luke Smith somewhere
    o $filename
    exit 0
done

Make sure to have it executable (chmod +x openreddit.sh) ant somewhere in your PATH The last step to do was to create the newsboat macro for it.

macro t pipe-to openreddit.sh

Now I can open any reddit media by pressing ,t with an open reddit post in newsboat Sadly it's not that easy with twitter, because I have not found a way to retreive the media files yet, but eventually I can figure it out.