asd
This commit is contained in:
parent
f882cb4027
commit
cbe1dae3c7
2 changed files with 0 additions and 53 deletions
|
@ -1,53 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Carga la configuracion desde ./config.sh
|
|
||||||
source ./config.sh
|
|
||||||
|
|
||||||
echo "Auth de twitch: $twitchauth"
|
|
||||||
echo "Client-Id de twitch: $clientid"
|
|
||||||
|
|
||||||
# Coloca aca el nombre del streamer de twitch
|
|
||||||
TWITCH_USER=""
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
TIME_DATE=[$(date +"%d/%m/%y")] # Formato de la fecha, usando el comando `date`. Ejemplo de como saldria: [31/12/22]
|
|
||||||
VIDEO_VISIBILITY="public" # Visibilidad del Video. Opciones disponibles: unlisted, private, public
|
|
||||||
VIDEO_DURATION="11:59:30" # Duración del video, si dura mas de el valor ingresado, se subira en partes divididas (Youtube solo tiene hasta videos de maximo 12 horas)
|
|
||||||
|
|
||||||
STREAMLINK_OPTIONS="best --hls-duration $VIDEO_DURATION --stream-segment-timeout 30 --hls-playlist-reload-attempts 10 --hls-live-restart --twitch-disable-hosting --twitch-disable-reruns -O --loglevel error" # https://streamlink.github.io/cli.html#twitch
|
|
||||||
|
|
||||||
echo "Checkqueando si $TWITCH_USER esta en vivo"
|
|
||||||
|
|
||||||
# Checkea si el streamer esta en vivo usando la API de twitch
|
|
||||||
checkstream=$(xh GET "https://api.twitch.tv/helix/streams?user_login=$TWITCH_USER" "Authorization: Bearer $twitchauth" "Client-Id: $clientid" -b | ./jtc -w '[data][:][type]' -qq)
|
|
||||||
|
|
||||||
# Si el streamer esta en vivo, empieza a subir a youtube
|
|
||||||
if [[ $checkstream = *live* ]]; then
|
|
||||||
STREAMER_NAME=$TWITCH_USER
|
|
||||||
VIDEO_PLAYLIST="$STREAMER_NAME VODs"
|
|
||||||
|
|
||||||
TWITCH_USER_ID=$(xh GET "https://api.twitch.tv/helix/users?login=$TWITCH_USER" "Authorization: Bearer $twitchauth" "Client-Id: $clientid" -b | ./jtc -w '[data][:][id]' -qq)
|
|
||||||
TWITCH_TITLE=$(xh GET "https://api.twitch.tv/helix/channels?broadcaster_id=$TWITCH_USER_ID" "Authorization: Bearer $twitchauth" "Client-Id: $clientid" -b | ./jtc -w '[data][:][title]' -qq)
|
|
||||||
TWITCH_TITLE_CUT=$(echo "$TWITCH_TITLE" | colrm 70 | tr "><" " ")
|
|
||||||
|
|
||||||
VIDEO_DESCRIPTION="Hosteado por Fijxu. https://twitch.tv/$TWITCH_USER \nTitulo Completo: $TWITCH_TITLE \nFecha y hora: $(date +"A las %H:%M horas, día %d/%m/%y") \nDonaciones: https://ko-fi.com/fijxu \nSi eres el streamer que aparece en el VOD y por alguna razon necesitas ocultar o recuperar (nunca borrare los VODs, eso va en contra de mi objetivo, aunque pueden haber excepciones) el VOD, puedes dejar un comentario, enviar un mensaje por Twitch @fijxu o usando el correo de contacto del canal. \n \nEste es un proyecto de caracter personal, me gusta archivar streams de twitch para que nada se pierda, y que todos puedan volver a ver streams del pasado sin problemas. 'Sharing is caring'" # Descripción del video
|
|
||||||
|
|
||||||
echo "Using Twitch user: $TWITCH_USER | ID: $TWITCH_USER_ID"
|
|
||||||
echo "Titulo del stream: $TWITCH_TITLE"
|
|
||||||
echo "Titulo del stream cortado: $TWITCH_TITLE_CUT"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# NOMBRE DEL STREAMER (TWITCH) - NOMBRE DEL TITULO CORTADO (por limitaciones de caracteres de youtube) - FECHA
|
|
||||||
VIDEO_TITLE="$STREAMER_NAME - $TWITCH_TITLE_CUT ~ $TIME_DATE"
|
|
||||||
|
|
||||||
# Crea el archivo JSON usado por youtubeuploader para agregar la información del VOD para Youtube
|
|
||||||
echo '{"title":"'"$VIDEO_TITLE"'","privacyStatus":"'"$VIDEO_VISIBILITY"'","description":"'"$VIDEO_DESCRIPTION"'","playlistTitles":["'"${VIDEO_PLAYLIST}"'"]}' >/tmp/input."$STREAMER_NAME"
|
|
||||||
|
|
||||||
echo "Titulo actualizado: $VIDEO_TITLE"
|
|
||||||
echo "En vivo, subiendo a YouTube"
|
|
||||||
streamlink https://twitch.tv/"$STREAMER_NAME" $STREAMLINK_OPTIONS | youtubeuploader -metaJSON /tmp/input."$STREAMER_NAME" -filename -
|
|
||||||
else
|
|
||||||
echo "No hay streams disponibles, reintentando en 10 seg"
|
|
||||||
fi
|
|
||||||
sleep 10s
|
|
||||||
|
|
||||||
done
|
|
Loading…
Add table
Reference in a new issue