How to list all public videos in an instance

Hi. I want to automate the videos backups of my instance. I just want to have a copy of the public videos leaving not listed videos « un-backed up ». For that, I need a way to get a list of all local public videos of my instance. I’ve been reading the API documentation but I don’t see how to achieve this thing.

Thanks!

You just have to backup the database and the storage folder (you can ignore the redundancy and the tmp subfolders)

The problem by backing up the storage folder is that it includes not listed videos. I don’t want to back-up unlisted or private videos.

Thanks for the question, it made me want to get interested in the API so here is what I did. So far I can get all the uuid of the videos that are public. After that I think it might not be too hard to deduce the files by looking up the video with its uuid, like this:
Infos about my video on api

Here is what I did if you want to go further:

  1. Get your token
  2. Get your users into a file
curl -s -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https://ptb.lunarviews.net/api/v1/users | python -m json.tool | grep username | awk -F" " '{print $2}' | sed 's/"//g' | sed 's/,//g' > instance-users.txt
  1. Take uuid of public videos from users and put to another file.
```bash
while IFS= read -r line
do
    echo "user : $line"
curl -s -H 'Authorization: Bearer ```
90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0
```' https://ptb.lunarviews.net/api/v1/accounts/$line/videos\?privacyOneOf\=1\&count\=100 | python -m json.tool | grep 'shortUUID' 
done < instance-users.txt > peertube-public-videos.txt

Now you have all uuid of Public vidéos from your instance.

You can try to get the path of the files and make an additional list with the files to export if you want to go further.

This can be a good start to make a script with the api (if I understand your need). There may be a more academic way or a tool already made, I hope it will help you.

Thanks for the answer! That looks like near to what I want. I just need to know how to get a list of all users since my instance has 800+.

I took some notes for this but they are not all translated, you can take the list of your users here at step 3

Tests avec l’API de Peertube.

Don’t forget to look here first, for the first steps :
Peertube REST API quick start

Number of users :

curl -s -H 'Authorization: Bearer YOUR_TOKEN_HERE' https://YOUR_INSTANCE_HERE/api/v1/users | python -m json.tool | grep total | awk -F" " '{print $2}' | sed 's/"//g' | sed 's/,//g'

Read, for big results (offsets & more requests)

Have fun