diff options
Diffstat (limited to '4viewer')
| -rwxr-xr-x | 4viewer | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +#!/bin/bash + +archivegif () { +LINK=$(curl -s "${1}") +title=$(echo "$LINK" | grep -oE post_title.*\<\/h2\> | head -1 | sed 's/post_title">//' | sed 's/<\/h2>//') +urls=$(echo "$LINK" | grep -oP '"\K[^"\047]+(?=["\047])' | grep -E ".gif|.webm" | grep -v "s\." | grep "//" | grep torako | uniq) +} + + +mpv-chan() { + URL=$1 + BOARD=$(echo $URL| grep -Po '([\w\d]+)\/thread' |cut -d'/' -f1) + title=$(curl -sL "${URL}.json" | jq -cr '.posts[0].sub') + urls=$(curl -sL "${URL}.json"|jq -cr '.posts[]|("https://i.4cdn.org/'${BOARD}'/"+(.tim|tostring) + .ext )'|grep -v null|paste -sd ' ') +} + +if [[ "$1" == *"boards"* ]]; then + mpv-chan "$1" + else + archivegif "$1" +fi +mpv --quiet --prefetch-playlist=yes --no-pause --force-media-title="$title" --demuxer-cache-wait=no $urls |
