Add ability to import just one video from youtube
This commit is contained in:
parent
1263fc4e6e
commit
35501c0fa7
|
@ -147,11 +147,11 @@ See the [docker guide](/support/doc/docker.md)
|
||||||
|
|
||||||
See the [production guide](/support/doc/production.md).
|
See the [production guide](/support/doc/production.md).
|
||||||
|
|
||||||
## Contributing
|
## Contributing/Test
|
||||||
|
|
||||||
See the [contributing
|
See the [contributing
|
||||||
guide](/.github/CONTRIBUTING.md)
|
guide](/.github/CONTRIBUTING.md)
|
||||||
to see how to contribute to PeerTube. Spoiler alert: you don't need to be a
|
to see how to test or contribute to PeerTube. Spoiler alert: you don't need to be a
|
||||||
coder to help!
|
coder to help!
|
||||||
|
|
||||||
## API REST documentation
|
## API REST documentation
|
||||||
|
@ -161,6 +161,10 @@ For now only on Github:
|
||||||
* HTML version: [/support/doc/api/html/index.html](/support/doc/api/html/index.html)
|
* HTML version: [/support/doc/api/html/index.html](/support/doc/api/html/index.html)
|
||||||
* Swagger/OpenAPI schema: [/support/doc/api/openapi.yaml](/support/doc/api/openapi.yaml)
|
* Swagger/OpenAPI schema: [/support/doc/api/openapi.yaml](/support/doc/api/openapi.yaml)
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
* [YouTube import](/support/doc/import-youtube.md)
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
See [ARCHITECTURE.md](/ARCHITECTURE.md) for a more detailed explanation.
|
See [ARCHITECTURE.md](/ARCHITECTURE.md) for a more detailed explanation.
|
||||||
|
|
|
@ -52,10 +52,16 @@ async function run () {
|
||||||
youtubeDL.getInfo(program['youtubeUrl'], options, processOptions, async (err, info) => {
|
youtubeDL.getInfo(program['youtubeUrl'], options, processOptions, async (err, info) => {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
// Normalize utf8 fields
|
let infoArray: any[]
|
||||||
info = info.map(i => normalizeObject(i))
|
|
||||||
|
|
||||||
const videos = info.map(i => {
|
// Normalize utf8 fields
|
||||||
|
if (Array.isArray(info) === true) {
|
||||||
|
infoArray = info.map(i => normalizeObject(i))
|
||||||
|
} else {
|
||||||
|
infoArray = [ normalizeObject(info) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
const videos = infoArray.map(i => {
|
||||||
return { url: 'https://www.youtube.com/watch?v=' + i.id, name: i.title }
|
return { url: 'https://www.youtube.com/watch?v=' + i.id, name: i.title }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
$ sudo apt install nginx ffmpeg postgresql openssl g++ make redis-server git
|
$ sudo apt install nginx ffmpeg postgresql openssl g++ make redis-server
|
||||||
```
|
```
|
||||||
|
|
||||||
## Arch Linux
|
## Arch Linux
|
||||||
|
@ -36,7 +36,7 @@ $ sudo pacman -S nodejs yarn ffmpeg postgresql openssl redis
|
||||||
$ sudo yum update
|
$ sudo yum update
|
||||||
$ sudo yum install epel-release
|
$ sudo yum install epel-release
|
||||||
$ sudo yum update
|
$ sudo yum update
|
||||||
$ sudo yum install nginx postgresql postgresql-server openssl gcc make redis git
|
$ sudo yum install nginx postgresql postgresql-server openssl gcc make redis
|
||||||
```
|
```
|
||||||
|
|
||||||
## Other distributions
|
## Other distributions
|
||||||
|
|
|
@ -11,19 +11,20 @@ Be sure you own the videos or have the author's authorization to do so.
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
You need at least 512MB RAM to run the script.
|
You need at least 512MB RAM to run the script.
|
||||||
Importation can be launched directly from a peertube server (in this case you already have dependencies installed :+1:) or from a separate server, even a dekstop PC.
|
Importation can be launched directly from a PeerTube server (in this case you already have dependencies installed :+1:) or from a separate server, even a dekstop PC.
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
If you do not run the script from a Peertube server, you need to follow the steps of the [dependencies guide](dependencies.md).
|
* [PeerTube dependencies](dependencies.md)
|
||||||
|
* git
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
Clone the Peertube repo to get the latest version inside your server:
|
Clone the PeerTube repo to get the latest version:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/Chocobozzz/PeerTube.git
|
git clone https://github.com/Chocobozzz/PeerTube.git
|
||||||
CLONE="$(pwd)/Peertube"
|
CLONE="$(pwd)/PeerTube"
|
||||||
```
|
```
|
||||||
|
|
||||||
Run ``yarn install``
|
Run ``yarn install``
|
||||||
|
@ -48,10 +49,13 @@ cd ${CLONE}
|
||||||
node dist/server/tools/import-youtube.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" -y "YOUTUBE_URL"
|
node dist/server/tools/import-youtube.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" -y "YOUTUBE_URL"
|
||||||
```
|
```
|
||||||
|
|
||||||
- PEERTUBE_URL : the full URL of your peertube server where you want to import, eg: https://peertube.cpy.re/
|
* PEERTUBE_URL : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re/
|
||||||
- PEERTUBE_USER : your peertube account where videos will be uploaded
|
* PEERTUBE_USER : your PeerTube account where videos will be uploaded
|
||||||
- PEERTUBE_PASSWORD : password of your peertube account
|
* PEERTUBE_PASSWORD : password of your PeerTube account
|
||||||
- YOUTUBE_URL : the youtube channel you want to import. Supports Youtube channel (eg https://www.youtube.com/channel/ChannelId) or Youtube user (eg: https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName)
|
* YOUTUBE_URL : the youtube video/user/channel/playlist you want to import. Examples:
|
||||||
|
* Channel: https://www.youtube.com/channel/ChannelId
|
||||||
|
* User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName
|
||||||
|
* Video https://www.youtube.com/watch?v=blabla
|
||||||
|
|
||||||
The script will get all public videos from Youtube, download them, then upload to Peertube.
|
The script will get all public videos from Youtube, download them and upload to PeerTube.
|
||||||
Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection, ... without problem.
|
Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
|
||||||
|
|
Loading…
Reference in New Issue