UNPKG

node-apiless-youtube-upload-nc

Version:

Upload videos to Youtube in Node.js without any Youtube API dependency by using Selenium.

51 lines (50 loc) 2.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const promptLoginAndGetCookies_1 = __importDefault(require("./methods/promptLoginAndGetCookies")); const promptLoginAndGetCookies_haokan_1 = __importDefault(require("./methods/promptLoginAndGetCookies_haokan")); const checkCookiesValidity_1 = __importDefault(require("./methods/checkCookiesValidity")); const checkCookiesValidity_haokan_1 = __importDefault(require("./methods/checkCookiesValidity_haokan")); const uploadVideo_1 = __importDefault(require("./methods/uploadVideo")); const uploadVideo_haokan_1 = __importDefault(require("./methods/uploadVideo_haokan")); const checkVideoCopyright_1 = __importDefault(require("./methods/checkVideoCopyright")); const remark_1 = __importDefault(require("./methods/remark")); const helpers_1 = require("./helpers"); class YoutubeUploader { cookies; async promptLoginAndGetCookies() { this.cookies = await (0, promptLoginAndGetCookies_1.default)(); return this.cookies; } async promptLoginAndGetCookies_haokan() { this.cookies = await (0, promptLoginAndGetCookies_haokan_1.default)(); return this.cookies; } async checkCookiesValidity() { return (0, checkCookiesValidity_1.default)(this.cookies); } async checkCookiesValidity_haokan() { return (0, checkCookiesValidity_haokan_1.default)(this.cookies); } async loadCookiesFromDisk(path) { this.cookies = helpers_1.Cookies.fromJSONFileSync(path); } async saveCookiesToDisk(path) { return this.cookies.saveToFileSync(path); } async checkVideoCopyright(vid, headlessMode, onProgress) { return (0, checkVideoCopyright_1.default)(vid, this.cookies, headlessMode, onProgress); } async remark(url, hs, vid, headlessMode, onProgress) { return (0, remark_1.default)(url, hs, this.cookies, vid, headlessMode, onProgress); } async uploadVideo(videoObj, headlessMode, onProgress) { return (0, uploadVideo_1.default)(videoObj, this.cookies, headlessMode, onProgress); } async uploadVideo_haokan(videoObj, headlessMode, onProgress) { return (0, uploadVideo_haokan_1.default)(videoObj, this.cookies, headlessMode, onProgress); } } exports.default = YoutubeUploader;