npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coub-dl

v1.8.1

Published

A coub downloader.

Downloads

39

Readme

coub-dl

A Coub downloader (CLI).

Installation

As local package:

$ npm i coub-dl

As CLI:

$ npm i -g coub-dl

Requirements

CLI Usage (Video)

List options and examples

$ coub-dl --help

Available options:

-V, --version          output the version number
-i, --input <input>    input (coub link or id)
-o, --output <output>  output file location
-c, --crop [crop]      crop the output (width:height:x_offset:y_offset)
-s, --scale <size>     resize the output (widthxheight)
-A, --no-audio         prevent addition of audio to the output
-l, --loop <times>     loop the coub X times
-t, --time <amount>    set the maximal amount of seconds for the length of the output
-d, --details          use in order to view the logs from ffmpeg while it works
-h, --help             output usage information
-f, --format           output file format (mp4, gif etc.)

Examples:

# Download coub without audio
$ coub-dl --input https://coub.com/view/135nqc --output out.mp4 --no-audio -C
# Download coub as gif, crop it as a square and scale it down to 250x250
$ coub-dl -i https://coub.com/view/135nqc -o out.gif --crop --scale 250
# Download coub and loop it 3 times
$ coub-dl -i https://coub.com/view/135nqc -o out.mp4 --loop 3 -C
# Download coub and make sure it's no longer than 12 seconds
$ coub-dl -i https://coub.com/view/135nqc -o out.mp4 --loop 10 --time 12 -C

Downloading coub for full length of audio

There is currently no explicit way of achieving this but you can do it through a sort of a "hack":

$ coub-dl -i https://coub.com/view/135nqc -o out.mp4 --loop 999

While looping the coub 999 times might sound scary, the script actually checks which part of the media (the audio or the video) is shorter, and crops it down to the shorter one. So if the video is a couple hours long and the audio is only 3 minutes long, the resulting file will be cropped down to 3 minutes.

It also works the other way around. If the audio is 3 minutes and the video is 15 seconds, the output is cropped to 15 seconds.

Resolving the output file path

coub-dl will try to resolve the output file path automatically if you don't specify it. By default, the coub title will be used as the file name. Here are some examples.

The coub title is Dance. Let the current directory be /home/coubs.

$ coub-dl -i https://coub.com/view/135nqc
# produces /home/coubs/Dance.mp4

$ coub-dl -i https://coub.com/view/135nqc --format gif
# produces /home/coubs/Dance.gif

If you do want to use a custom path but also include the coub title, you can use the :name: special pattern in the path which will be replaced with the coub title.

$ coub-dl -i https://coub.com/view/135nqc -o /my/custom/directory/:name:.gif
# produces /my/custom/directory/Dance.gif

You may also omit the file extension, which will default to mp4.

$ coub-dl -i https://coub.com/view/135nqc -o /my/custom/directory/:name:
# produces /my/custom/directory/Dance.mp4

NOTE: If you do specify a file extension in the path, the --format option will be ignored. For example:

$ coub-dl -i https://coub.com/view/135nqc -o /my/custom/directory/:name:.mp4 -f gif
# produces /my/custom/directory/Dance.mp4

CLI Usage (Audio)

This is an utility that lets you download the audio from coubs separately.

List options and examples:

$ coub-dl-mp3 --help

Available options:

-V, --version          output the version number
-i, --input <input>    input (coub link or id)
-o, --output <output>  output file location
-h, --help             output usage information

Examples:

$ coub-dl-mp3 -i https://coub.com/view/135nqc -o out.mp3
$ coub-dl-mp3 -i https://coub.com/view/135nqc

The output file path resolves the same way as with the video CLI, except the format defaults to mp3.

Documentation

Coub

Extends FFmkek.

const Coub = require('coub-dl')

Coub.fetch(url[, quality])

Takes a coub URL (or just ID), fetches it and returns a Coub instance. Optionally takes a quality argument. Can only be high or med.

const coub = await Coub.fetch('http://coub.com/view/w6uc9')
// => Promise<Coub>

Coub.prototype.crop([data])

Takes an argument similar to the FFmpeg crop filter except it is optional. If no data is provided the output is cropped as a centered square.

coub.crop() // Crops centered square
coub.crop('500:200:0:0') // Crop 500x200 with no offset from top right
// => Coub

Coub.prototype.scale(data)

Scale the output video.

coub.scale(250) // Scale the video to 250 pixel width while preserving aspect ratio
coub.scale('-2:100') // Scale the video to 100 pixel height while preserving aspect ratio
coub.scale('250:100') // Scale the video to 250x100
// => Coub

Coub.prototype.attachAudio()

Attaches the Coub audio to the output. NOTE: Do this before applying any other filters. Unless you want to apply the filters to the audio.

coub.attachAudio()
// => Coub

Coub.prototype.loop(times)

Loop the video a given amount of times. If the video ends up longer than the audio, it is shortened to the length of the audio.

coub.loop(3)
// => Coub

Writing the output

The write() method is inherited from FFmkek.

coub.write('my/coub/dir/thing.mp4')
// => Promise<string>

coub.write()
// => Promise<Stream>