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

@lowlighter/rakun

v1.0.7

Published

A parser for anime torrent to extract features

Downloads

52

Readme

🦝 Rakun - An Anime torrent name parser

Onee-chan Tests passed Coverage Code quality Version License

A parser to extract informations and metadata from anime torrents filename. With this, it'll be easier to script anime torrents related stuff !

💻 Usage

📦 Installation

You can either use default npm registry (https://registry.npmjs.org) or the GitHub package registry (https://npm.pkg.github.com).

npm install @lowlighter/rakun --save

⏪ With the following code...

import rakun from "rakun"
console.log(rakun.parse("[Team246] Ghost in the shell Stand alone complex S01 E10-E15 [BDREMUX 1080P MULTi DTSHDMA 5.1][VOSTFR]"))

⏩ You'll get the following output :

{
  filename:"[Team246] Ghost in the shell Stand alone complex S01 E10-E15 [BDREMUX 1080P MULTi DTSHDMA 5.1][VOSTFR]",
  subber:"Team246",
  name:"Ghost in the shell Stand alone complex",
  season:"1",
  episode:"10-15",
  resolution:"1080p",
  audio:"multi vo",
  subtitles:"fr",
  source:"bluray",
  codecs:"audio_5_1 dts_hdma",
  meta:"remux",
}

📊 What's rakun performances ?

We try to gather a lot of different torrents name format from all over the net to make rakun more efficient and reliable. You can check tests cases to see what kind of formatting is currently supported.

Below is an excerpt of tests cases which may help you to check rakun's capabilities :

- [Leopard-Raws] Shingeki no Kyojin Season 3 Part.2 - 09 END RAW (NHKG 1280x720 x264 AAC).mp4
- [Team246] Ghost in the shell Stand alone complex S01 E10-E15 [BDREMUX 1080P MULTi DTSHDMA 5.1][VOSTFR]
- [U3-Web] PSYCHO-PASS 3 - FIRST INSPECTOR (2020) [Movie][AMZN WEB-DL(v) 1080p AVC AAC DDP SRT][Multi-Subs] (PSYCHO-PASS サイコパス / 心靈判官 / 心理測量者)
- [Kaerizaki-Fansub]_One-Piece_Stampede_Film_14_[VERSION-LIGHT][VOSTFR][BLU-RAY][FHD_1920x1080].mp4
- Serial Experiments Lain (1998) 1080p.H264.Ac3.Ita.Flac.Jap.Eng.Sub.Ita.Eng [v2] [21GB] [stress]
- [T.H.X&A.I.R.nesSub][Shinsekai_Yori][BDRIP][Vol.1-9全][1920x1080_10bpp][AVC_FLAC][MKV]
- [BDRip1080p.x264.AC3.ITA.ENG.JAP.].Fullmetal.Alchemist.Brotherhood + OAV Bluray RIP
- [AnimeRG] Spirited Away (2001) (Sen to Chihiro no Kamikakushi) [720p BD 10bit] [Dual Audio] [Multi-Language Subtitles] [JRR] [Studio Ghibli].mkv
- Death Note 1-37 [480p] [EN SUB]
- Dragon.Ball.Z.Movie.14.Battle.of.Gods.2013.EXTENDED.DUAL.AUDiO.SUB.PL.1080p.BluRay.REMUX.AVC.TrueHD.5.1-SeBoLeX
- [Erai-raws] Berserk 2017 - 12 [v2][END][720p][Multiple Subtitle][10A073DC].mkv
- [BDMV] Made in Abyss / メイドインアビス [BD-BOX I+II][JP]
- Naruto.SD.Rock.Lee.no.Seishun.Full-Power.Ninden.S01.FRENCH.DVDRiP.x264-Kazelle
- Evangelion 1.11 You Are (Not) Alone 2007 Multi 1080p Blu-ray Remux AVC DTS-HD MA 6.1 VFF 5.1 H264 [Team246]

📑 Extracted informations

Below is the descriptor of the possible extreacted torrent informations. Multiple values properties (codecs, audio, subtitles, etc.) are sorted to keep consistancy.

/** Torrent informations. */
  interface TorrentInfos {
    //Original filename
      readonly filename:string
    //Cleaned name
      readonly name:string
    //Hash
      readonly hash?:string
    //File extension
      readonly extension?:string
    //Resolution
      readonly resolution?:string
    //Source (Bluray, DVD, etc.)
      readonly source?:string
    //Codecs
      readonly codecs?:string
    //Audio language
      readonly audio?:string
    //Subtitles language
      readonly subtitles?:string
    //Subber group (or translation group)
      readonly subber?:string
    //Website of subber
      readonly website?:string
    //Content producer/distributor
      readonly distributor?:string
    //Torrent other metadata (remux, repack, etc.)
      readonly meta?:string
    //Movie
      readonly movie?:string
    //Season
      readonly season?:string
    //Part
      readonly part?:string
    //Episode (or episode range)
      readonly episode?:string
  }

🔧 Under the hood

🧬 ATNP's logic

Parsing follows the following workflow :

  • An input filename is given, with possible parser options
  • Pre-processors are executed
  • Main processor iterates through the collection of regexs to extract informations from filename
    • At each iteration, extracted informations can be either removed from filename through cleaners are applied to remove remnants, or keept for next iteration for closely related informations (like season, parts and episode)
  • Post-processors are executed
  • The remaining part of filename is considered as the cleaned title
  • Extracted informations are returned

📰 Additional informations

Regexs are ordered to match first what can be accurately extracted and removed early (like hash, extension, website, etc.) to ease the remaining extraction.

Except for cleaners and specials regexs, they should have named capture groups. (if capture group are needed). It allows easier understanding of regexs, but it is also the way that the parser register data.

The main processor is a list of descriptors with the following properties :

{
  key?:string,                      // Property to set (e.g. audio, episode, meta, etc..)
  collection?:RegExp[],             // Regex collection to use
  get?:"key"|"value",               // If "key", will return capture group's name ; if "value", will return capture group's value
  mode?:"append"|"replace"|"skip",  // If "append", add value (or create) to property ; if "replace", replace property ; if "skip", skip if property already defined
  clean?:boolean,                   // If true, cleaners will be applied at the end of the iteration
  cleaners?:RegExp[]                // Additional cleaners to apply
}

While the aim is to reach 100% accuracy, note that this objective is nearly impossible since there are too much outliers in naming conventions across various websites.

🏅 Code quality

To ensure a quality library, code is required to pass Onee-chan's judgement and fulfill a parsing accuracy of at least 85% of defined test cases.

Pull requests may not be merged if they do not reach this standard, unless they are adding revelant tests which may reveal missed matches in current builds. Although edges cases should be integrated to challenge rakun, simpler cases should also be added to not biases Onee-chan's evaluation.

💪 Contributing

Want to contribute ? Sugoï ! Here what you can help with :

Open a pull request to

Open an issue to

  • Reports bugs or unsupported format that should be
  • Ask help

🧾 License

rakun is licensed under the MIT License.