#!/bin/sh
stdin=y
for i in $@; do
    [ -e "$i" ] && stdin=
done

if [ -n "$stdin" ]; then
    sed 's|www.youtube.com/watch?v=|youtu.be/|g ; s|www.sakugabooru.com/data/.*\?id=|www.sakugabooru.com/post/show/|' < /dev/stdin | xclip -r -selection clipboard $@
else
    xclip -r -selection clipboard $*
fi

