add get latest magnet video function

This commit is contained in:
localhost_frssoft 2022-03-06 17:17:17 +03:00
parent b7b802b9a1
commit d3a1d50339
1 changed files with 34 additions and 10 deletions

View File

@ -2,7 +2,7 @@
domain='xxivproduction.video' domain='xxivproduction.video'
channel='kafazen_channel' channel='kafazen_channel'
count=100 count=100 # set to 1 for get latest video from channel
peertube_api_get_channel_videos () peertube_api_get_channel_videos ()
@ -18,13 +18,37 @@ peertube_api_get_video ()
echo 'Getting uuids...' echo 'Getting uuids...'
get_uuids=$(peertube_api_get_channel_videos | jj -l data.#.uuid | sed 's/"//g') get_uuids=$(peertube_api_get_channel_videos | jj -l data.#.uuid | sed 's/"//g')
echo 'Done\n' echo 'Done\n'
echo 'Getting names and magnet uri...'
for uuid in $get_uuids; do get_all_magnets ()
video=$(peertube_api_get_video $uuid) {
echo $video | jj name >> "$channel".md echo 'Getting names and magnet uri...'
echo '```' >> "$channel".md for uuid in $get_uuids; do
echo $video | jj -l 'streamingPlaylists' | jj -l 'files.#.magnetUri' >> "$channel".md video=$(peertube_api_get_video $uuid)
echo '```' >> "$channel".md echo $video | jj name >> "$channel".md
sleep 1 echo '```' >> "$channel".md
done 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
echo 'Done' echo 'Done'