UNPKG

twt-dl-cli

Version:

The easiest way to download any Twitter video from CLI

3 lines (2 loc) 1.05 kB
#!/usr/bin/env node var p=Object.defineProperty;var r=(o,t)=>p(o,"name",{value:t,configurable:!0});import{cli as u}from"cleye";import{downloadVideo as w,downloadFile as v}from"./index.mjs";import"cheerio";import"cross-fetch";import"download";import"ora";import"node:fs";import"node:path";import"node:process";var f=r((o,t,i)=>new Promise((s,a)=>{var c=r(e=>{try{l(i.next(e))}catch(n){a(n)}},"fulfilled"),m=r(e=>{try{l(i.throw(e))}catch(n){a(n)}},"rejected"),l=r(e=>e.done?s(e.value):Promise.resolve(e.value).then(c,m),"step");l((i=i.apply(o,t)).next())}),"__async");const y=["yes","no"];function h(o){if(!y.includes(o))throw new Error(`Invalid download option: "${o}"`);return o}r(h,"downloadSchema");const d=u({name:"twt-dl-cli",parameters:["<twitter url>"],flags:{download:{type:h,description:"Allow to download video (yes/no)",default:"yes"}}});function _(){return f(this,null,function*(){var o;const t=yield w((o=d._)==null?void 0:o.twitterUrl);console.log(t),d.flags.download==="yes"&&t&&(yield v(t))})}r(_,"main"),_().catch(console.error);