diff --git a/recomendador.sh b/recomendador.sh new file mode 100755 index 0000000..f0419fb --- /dev/null +++ b/recomendador.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# apt install git toot wget +# toot login # Just the first time + +peertubeNode="fediverse.tv" +apiUrlLastVideos="https://$peertubeNode/api/v1/videos" +tmpFile="/tmp/.lastChannelsPeertube" + +function main { + getLastChannelsAccountsWithActivity + createTootMsg +} + +function getLastChannelsAccountsWithActivity { + wget -q "$apiUrlLastVideos" -O - | tr "\"" "\n" | grep -i "https://$peertubeNode/video-channels" | cut -d "/" -f 5 | sort -u > $tmpFile + readarray -t channel < $tmpFile && > $tmpFile + for a in "${channel[@]}"; do echo "@$a@$peertubeNode" >> $tmpFile; done + readarray -t channel < $tmpFile +} + +function createTootMsg { + tootMsg="Cuentas recomendadas para seguir ${channel[@]}. Cuentas con contenido multimedia que han tenido actividad en las Ășltimas 24horas #fediverse #fediverso #video #peertube #canales #channels" + toot post "$tootMsg" +} + +main