Created
November 9, 2017 08:51
-
-
Save brammittendorff/7404dc8a18539c8898c2b47f5ce19f6b to your computer and use it in GitHub Desktop.
Chaturbate recorder
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 | |
URL="${2}" | |
NAME="$(echo "${URL}" | sed 's#.*/\([^/]*\)/$#\1#')" | |
pgrep -f "/${NAME}-.*/playlist.m3u8" && exit | |
STREAM="$(curl -s "${URL}" | grep hlsSourceFast | sed -n 's#.*\(https://.*/playlist.m3u8\).*#\1#p')" | |
ROOT_DIR=$HOME/x | |
case "${1}" in | |
vlc|v) | |
vlc "${STREAM}" | |
;; | |
ffmpeg|f) | |
DATE="$(date +%Y-%m-%d_%H:%M:%S)" | |
DIRECTORY="${ROOT_DIR}/${NAME}" | |
[ -d "${DIRECTORY}" ] || mkdir -p "${DIRECTORY}" | |
FILENAME="${NAME}/${DATE}.webm" | |
FILE="${ROOT_DIR}/${FILENAME}" | |
cd "${ROOT_DIR}" | |
LINK="${DATE}_${NAME}.webm" | |
ln -s "${FILENAME}" "${LINK}" | |
ffmpeg -i "${STREAM}" -strict -2 -codec:a libvorbis -b:a 128k -ac 2 -codec:v libvpx -b:v 2000k -maxrate 2000k -bufsize 4000k -qmin 10 -qmax 42 "${FILE}" | |
[ -f "${FILE}" ] || rm "${LINK}" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment