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

subclean

v1.8.1

Published

A CLI package to clean subtitle files of advertising

Downloads

73

Readme

subclean

NPM NPM Documentation Maintenance License: MIT

A powerful CLI tool and node module to remove advertising from subtitle files. Made for personal media servers with full support for automation tools like Bazarr. Simple to use and frequently updated with new filters.

Preview

Download

Downloads for Windows, Linux and Mac can be found on the releases page.
Alternatively, you can install using NodeJS:

npm install -g subclean

Or you can build it yourself: npm install && npm run build

Usage

If you are using this as a node module scroll down to the node module/npm section.

If using Bazarr, please see the wiki page.

Usage: subclean [options]
Example: subclean subtitle.srt -w
Bulk: subclean --sweep "path/to/media"

Options:
  -i, --input      The file you want to clean
  -o, --output     Where to write the cleaned file (defaults to input)
  -w, --overwrite  Overwrite the output file if it already exists
  -c, --clean      Delete the input file before writing the output
  -v, --version    Display current version
  -n, --no-check   Don't check for a new package version
  -s, --silent     Silent mode. Nothing logged to console
      --update     Download the latest filters from GitHub
                   This will not update subclean, only the filters!

      --sweep      Bulk subtitle cleaning. Searches for subtitles
                   in multiple directories (and sub-directories)
                   This will enable --overwrite!

      --nochains   Attempt to match and remove chained nodes. Experimental.
      --depth      How many sub-directories to look when sweep cleaning
      --debug      Display extra debugging information
      --help       Show the text you're reading now
      --ne         No Empty (nodes). Deletes empty nodes after cleaning.
      --testing    Testing mode. Will not modify files.
      --uf         Use Filter: internal or appdata

🧹 Bulk Cleaning

Scans for subtitle files and cleans them one by one.
Depth is optional. Take a look at the depth map for a visual guide on what depth to use.

subclean --sweep "path/to/media" --depth 5
// or
subclean --sweep

📝 Filters

When you run subclean --update new filters will be downloaded from GitHub. The location of these files may differ depending on what OS you are using. If the downloaded filters do not exist or can not be accessed the internal filters will be used instead

You can create custom.json alongside the downloaded filters. Subclean will automatically load this and apply it when cleaning. You can verify this is being loaded by running subclean --debug. You should see a message similar to Loaded n filters from custom

Node Module

As of 1.6.2 and above this can now be used as a node module, allowing you to pass raw text through the cleanRaw function. Usage is as follows:

npm install subclean --save
import { subclean } from 'subclean';

const testdata = `1
00:00:06,000 --> 00:00:12,074
Watch Movies, TV Series and Live Sports
Signup Here -> WWW.ADMITME.APP

2
00:00:27,319 --> 00:00:28,820
Or you can remove that annoying ad using subclean!

3
00:00:28,903 --> 00:00:30,447
Now with support for node modules.`;

subclean.cleanRaw(testdata).then(console.log);

Result:

1
00:00:27,319 --> 00:00:28,820
Or you can remove that annoying ad using subclean!

2
00:00:28,903 --> 00:00:30,447
Now with support for node modules.

You can still pass arguments to customize the process.

const config = { nochains: true, ne: true };
subclean.cleanRaw(testdata, config).then(console.log);

If the data is invalid you will receive an error

const testdata = `this is invalid data`;
subclean.cleanRaw(testdata).then(console.log).catch(console.log);
// Error: Unable to parse subtitles

👤 Author

This project was made by Kain (ksir.pw)

🤝 Contributing

Contributions, issues and feature requests are welcome and greatly appreciated.
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2021 Kain (ksir.pw). This project is MIT licensed.