From 3d53ad7bbd9469eaca554327f86665a33380e13a Mon Sep 17 00:00:00 2001 From: VC Date: Mon, 16 Oct 2023 21:36:41 +0200 Subject: [PATCH] doc: update documentation --- README.md | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index bfbe526..6cb3ced 100644 --- a/README.md +++ b/README.md @@ -6,50 +6,57 @@ This program takes the very last video published on a PeerTube instance and push This is an early prototype not really suited for production purposes for now: * it still relies way too much on pre-determined value to upload the video to YouTube -* it cannot determine the playlists it needs to put them in * it cannot determine the recording date (believe me, I tried!) -* there are still a lot of static values that I would rather not have static (like the cache directory…) -* it is 100% sync, meaning it’s clearly not optimal for now and probably won’t be for the next releases -So consider this a work in progress that will slowly get better with time +So consider this a work in progress that will slowly get better with time. # What does it do exactly? -* it downloads the latest PeerTube video from an instance -* stores it in cache directory -* uploads it to YouTube +* it retrieves the latest PeerTube video download URL from an instance +* it creates a resumable upload into the target YouTube account +* it downloads/uploads the latest PeerTube video to YouTube without using a cache (stream-to-stream) # What doesn’t it do exactly? -* it cannot register the original key (see below) -* it relies on a local cache despite the fact that it might well be possible to just download from PT/upload to YT at the same time (I don’t see why not in fact) * it doesn’t retrieve ALL the original PeerTube video properties like licences, languages, categories, etc… again: early prototype -# Obtain Authorization Token from Google +# Howtos +## General usage -That the complicated part: -* create an OAuth2.0 application with authorization for Youtube DATA Api v3 Upload +Once you fill your `tootube.toml` config file (see below), you can run `tootube` like this: + +```bash +tootube --config tootube.toml --playlist playlist_1 "Things You Might Like" +``` + +You can turn on debug using env var `RUST_LOG`. + +## Obtain Authorization Token from Google + +The complicated part: +* create an OAuth2.0 application with authorization for Youtube DATA Api v3 Upload and Youtube DATA Api v3 (generally referenced as `../auth/youtube.upload` and `../auth/youtube`) * create a OAuth2.0 client with Desktop client You’ll need: * the `client_id` from your OAuth2.0 client * the `client_secret` from you OAuth2.0 client -Then enter in: +Create your `tootube.toml` config file: -``` -https://accounts.google.com/o/oauth2/v2/auth?client_id=XXX.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://www.googleapis.com/auth/youtube.upload&response_type=code +```toml +[peertube] +base_url="https://p.nintendojo.fr" + +[youtube] +refresh_token="" # leave empty for now +client_id="" +client_secret="" ``` -And accept that your YouTube account might be modified. You’ll get a code then; enter this `curl` post: +Then run: -``` -curl -s \ ---request POST \ ---data "code=[THE_CODE]&client_id=XXX.apps.googleusercontent.com&client_secret=[THE_CLIENT_SECRET]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" \ -https://accounts.google.com/o/oauth2/token +```bash +tootube register --config ``` -You’ll get a Token. The only important part is the `refresh_token` - -In your `tootube.toml` config file, put the `refresh_token`. +You’ll be then prompted with all the necessary information to register `tootube`. You’ll end with a `refresh_token` that you can now paste inside your tootube configuration.