youtube-likes-downloader
Version:
Download all liked videos from youtube
46 lines • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = run;
exports.check = check;
exports.update = update;
exports.add = add;
const google_api_wrapper_1 = require("@anmiles/google-api-wrapper");
const logger_1 = require("@anmiles/logger");
const addVideo_1 = require("./addVideo");
const download_1 = require("./download");
const likes_1 = require("./likes");
const validate_1 = require("./validate");
async function run(profile) {
for (const foundProfile of (0, google_api_wrapper_1.filterProfiles)(profile)) {
(0, logger_1.info)(`Importing likes from ${foundProfile}...`);
await (0, likes_1.importLikes)(foundProfile);
(0, logger_1.info)(`Downloading videos from ${foundProfile}...`);
await (0, download_1.download)(foundProfile);
}
(0, logger_1.info)('Done!');
}
function check(profile) {
for (const foundProfile of (0, google_api_wrapper_1.filterProfiles)(profile)) {
(0, logger_1.info)(`Validating filenames (${foundProfile})...`);
(0, validate_1.validate)(foundProfile);
}
(0, logger_1.info)('Done!');
}
async function update(profile) {
for (const foundProfile of (0, google_api_wrapper_1.filterProfiles)(profile)) {
(0, logger_1.info)(`Exporting likes into ${foundProfile}...`);
await (0, likes_1.exportLikes)(foundProfile);
}
(0, logger_1.info)('Done!');
}
async function add(profile) {
if (!profile) {
throw new Error('Video should be added to the particular profile; specify it as `npm add <profile>`');
}
for (const foundProfile of (0, google_api_wrapper_1.filterProfiles)(profile)) {
(0, logger_1.info)(`Adding video for ${foundProfile}...`);
await (0, addVideo_1.addVideo)(foundProfile);
}
(0, logger_1.info)('Done!');
}
//# sourceMappingURL=app.js.map