2022-03-05 10:52:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
domain='xxivproduction.video'
|
2022-03-06 13:13:59 +00:00
|
|
|
channel='kafazen_channel'
|
2022-03-06 14:17:17 +00:00
|
|
|
count=100 # set to 1 for get latest video from channel
|
2022-03-05 10:52:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
peertube_api_get_channel_videos ()
|
|
|
|
{
|
2022-03-05 23:12:47 +00:00
|
|
|
curl -S "https://$domain/api/v1/video-channels/$channel/videos?count=$count&skipCount=true"
|
2022-03-05 10:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
peertube_api_get_video ()
|
|
|
|
{
|
2022-03-05 23:12:47 +00:00
|
|
|
curl -S "https://$domain/api/v1/videos/$1"
|
2022-03-05 10:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo 'Getting uuids...'
|
|
|
|
get_uuids=$(peertube_api_get_channel_videos | jj -l data.#.uuid | sed 's/"//g')
|
|
|
|
echo 'Done\n'
|
2022-03-06 14:17:17 +00:00
|
|
|
|
|
|
|
get_all_magnets ()
|
|
|
|
{
|
|
|
|
echo 'Getting names and magnet uri...'
|
|
|
|
for uuid in $get_uuids; do
|
|
|
|
video=$(peertube_api_get_video $uuid)
|
|
|
|
echo $video | jj name >> "$channel".md
|
|
|
|
echo '```' >> "$channel".md
|
|
|
|
echo $video | jj -l 'streamingPlaylists' | jj -l 'files.#.magnetUri' >> "$channel".md
|
|
|
|
echo '```' >> "$channel".md
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
get_latest_magnet_video ()
|
|
|
|
{
|
|
|
|
echo 'Getting name and magnet uri...'
|
|
|
|
for uuid in $get_uuids; do
|
|
|
|
video=$(peertube_api_get_video $uuid)
|
|
|
|
echo $video | jj name >> temp_"$channel".md
|
|
|
|
echo '```' >> temp_"$channel".md
|
|
|
|
echo $video | jj -l 'streamingPlaylists' | jj -l 'files.#.magnetUri' >> temp_"$channel".md
|
|
|
|
echo '```' >> temp_"$channel".md
|
|
|
|
cat "$channel".md >> temp_"$channel".md
|
|
|
|
mv temp_"$channel".md "$channel".md
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $count -eq 1 ]; then
|
|
|
|
get_latest_magnet_video
|
|
|
|
else
|
|
|
|
get_all_magnets
|
|
|
|
fi
|
2022-03-05 10:52:07 +00:00
|
|
|
echo 'Done'
|