1.0.2 • Published 10 months ago

@h3mul/reuploader v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
10 months ago

Reuploader

A simple library to contain logic for uploading data streams to various destinations, with a consistent interface.

Implemented uploaders and supported features:

YoutubeUploader

Prerequisite: set up OAuth refresh token

Option KeyDescriptionType
title*youtube video titlestring
description*youtube video descriptionstring
source*arbitrary data streamnode:stream
insertIntoPlaylistan existing playlistId to insert the new video into after uploadstring
unlistedwhether the new upload should be marked as unlisted; false = public (default: false)boolean

* = required

example

import { Source, YoutubeUploader } from '@hemul/reuploader';
import token from './.token.json' assert { type: 'json' };

const exampleFileStream = Source.getFileStream({ path: './examples/test_video.mp4' });

const uploader = new YoutubeUploader({
    token,
    client_id: process.env.YOUTUBE_CLIENT_ID!,
    client_secret: process.env.YOUTUBE_CLIENT_SECRET!,
});

logger.debug('Starting upload');
const { videoUrl } = await uploader.upload({
    title: 'Test Video',
    description: 'test video description',
    source: exampleFileStream,
    insertIntoPlaylist: '<playlist id>',
    unlisted: true
});
logger.debug('Upload complete: ' + videoUrl);
1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago