]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/tools.md
Add API example to list videos
[github/Chocobozzz/PeerTube.git] / support / doc / tools.md
CommitLineData
358770db 1# CLI tools guide
2519d9fe
L
2
3 - [Installation](#installation)
4 - [Usage](#usage)
635a5686
C
5 - [import-videos.js](#import-videosjs)
6 - [upload.js](#uploadjs)
a5f0521f
RK
7 - [create-transcoding-job.js](#create-transcoding-jobjs)
8 - [create-import-video-file-job.js](#create-import-video-file-jobjs)
2519d9fe
L
9
10## Installation
11
12## Prerequisites
13
99402413
C
14You need at least 512MB RAM to run the script.
15Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
05e67d62 16You need to follow all the following steps even if you are on a PeerTube server.
2519d9fe
L
17
18### Dependencies
19
358770db 20Install the [PeerTube dependencies](dependencies.md).
2519d9fe
L
21
22### Installation
23
99402413 24Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
2519d9fe
L
25
26```
05e67d62
C
27$ git clone https://github.com/Chocobozzz/PeerTube.git
28$ CLONE="$(pwd)/PeerTube"
2519d9fe
L
29```
30
31Run ``yarn install``
32```
05e67d62
C
33$ cd ${CLONE}
34$ yarn install
2519d9fe
L
35```
36
37Build server tools:
38```
05e67d62
C
39$ cd ${CLONE}
40$ npm run build:server
2519d9fe
L
41```
42
358770db 43## Tools
2519d9fe 44
358770db
C
45### import-videos.js
46
47You can use this script to import videos from all [supported sites of youtube-dl](https://rg3.github.io/youtube-dl/supportedsites.html) into PeerTube.
48Be sure you own the videos or have the author's authorization to do so.
2519d9fe 49
a5f0521f
RK
50```sh
51$ node dist/server/tools/import-videos.js \
52 -u "PEERTUBE_URL" \
53 -U "PEERTUBE_USER" \
54 --password "PEERTUBE_PASSWORD" \
55 -t "TARGET_URL"
2519d9fe
L
56```
57
a5f0521f
RK
58* `PEERTUBE_URL` : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re
59* `PEERTUBE_USER` : your PeerTube account where videos will be uploaded
60* `PEERTUBE_PASSWORD` : password of your PeerTube account (if omitted, you will be prompted for it)
61* `TARGET_URL` : the target url you want to import. Examples:
62 * YouTube:
63 * Channel: https://www.youtube.com/channel/ChannelId
64 * User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName
65 * Video https://www.youtube.com/watch?v=blabla
66 * Vimeo: https://vimeo.com/xxxxxx
67 * Dailymotion: https://www.dailymotion.com/xxxxx
2519d9fe 68
35501c0f
C
69 The script will get all public videos from Youtube, download them and upload to PeerTube.
70 Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
358770db
C
71
72### upload.js
73
74You can use this script to import videos directly from the CLI.
75
76```
05e67d62
C
77$ cd ${CLONE}
78$ node dist/server/tools/upload.js --help
358770db 79```
a5f0521f
RK
80
81## Tools to create jobs in the queue
82
83### create-transcoding-job.js
84
85You can use this script to force transcoding of an existing video.
86
87```
88$ npm run create-transcoding-job -- -v [videoUUID]
89```
90
91### create-import-video-file-job.js
92
93You can use this script to import a video file to replace an already uploaded file or to add a new resolution to a video.
94
95```
96$ npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
97```