Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

jbstinson/ani-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ani-cli-node

A Windows-native Node.js CLI tool for browsing and streaming anime from your terminal. Inspired by the original ani-cli, reimplemented in TypeScript just for fun.

Features

  • 🔍 Search anime by title with fuzzy matching
  • 📺 Stream episodes directly in your media player (MPV or VLC)
  • 🎬 Quality selection (1080p, 720p, 480p, etc.)
  • 🗣️ Dub/Sub support - watch dubbed or subtitled versions
  • 📜 Watch history - resume where you left off
  • 🔄 Multi-provider fallback - reliable streaming from multiple sources
  • 🎯 Episode ranges - binge-watch multiple episodes (e.g., 1-10)
  • ⚙️ Configurable - customize quality, player, and preferences
  • 🎨 Beautiful UI - colorful terminal interface with chalk

Installation

Prerequisites

  1. Node.js 18+ (Download)
  2. Media Player - Install one of the following:

Installing MPV on Windows

Option 1: Chocolatey (Recommended)

choco install mpv

Option 2: Scoop

scoop install mpv

Option 3: Manual Installation

  1. Download from mpv.io/installation
  2. Extract to C:\mpv\ or C:\Program Files\mpv\
  3. Add to PATH or configure in ani-cli

Install ani-cli-node

# Clone the repository
git clone https://github.com/yourusername/ani-cli-node.git
cd ani-cli-node

# Install dependencies
npm install

# Build the project
npm run build

# Install globally (optional)
npm install -g .

Usage

Basic Search and Stream

# Search for an anime
ani-cli "death note"

# Search with episode selection
ani-cli "attack on titan" -e 5

# Watch episode range (binge mode)
ani-cli "cowboy bebop" -e 1-10

Options

ani-cli [search] [options]

Options:
  -d, --dub                Watch dubbed version
  -q, --quality <quality>  Quality preference (best, worst, 1080p, 720p, 480p, 360p)
  -e, --episode <number>   Episode number or range (e.g., 5 or 1-10)
  -c, --continue           Continue watching from history
  -p, --player <name>      Preferred player (mpv, vlc, auto)
  --debug                  Enable debug logging
  -h, --help              Display help
  -V, --version           Display version

Examples

Search and select interactively:

ani-cli
# Enter search query when prompted

Watch specific episode:

ani-cli "one piece" -e 1000

Watch with quality preference:

ani-cli "demon slayer" -e 1 -q 720p

Watch dubbed version:

ani-cli "cowboy bebop" --dub

Continue from history:

ani-cli --continue

Binge watch episodes 1-25:

ani-cli "steins gate" -e 1-25

Commands

View watch history:

ani-cli history

Manage configuration:

# View all settings
ani-cli config get

# View specific setting
ani-cli config get defaultQuality

# Change setting
ani-cli config set defaultQuality 1080p
ani-cli config set preferredPlayer mpv

# Reset to defaults
ani-cli config reset

Clear history:

ani-cli clear-history

Configuration

Configuration is stored in %APPDATA%\ani-cli-node-nodejs\config.json

Available Settings

Setting Type Default Description
defaultQuality string best Default video quality (best, worst, 1080p, 720p, 480p, 360p)
preferredPlayer string auto Media player (mpv, vlc, auto)
playerPath string - Custom player path (optional)
translationType string sub Default audio (sub, dub)
historyEnabled boolean true Enable watch history
maxHistoryEntries number 100 Maximum history entries
cacheTimeout number 300000 Cache timeout in milliseconds
retryAttempts number 3 HTTP retry attempts
debug boolean false Enable debug logging

Example Configuration

# Set default quality to 1080p
ani-cli config set defaultQuality 1080p

# Always use MPV
ani-cli config set preferredPlayer mpv

# Prefer dubbed anime
ani-cli config set translationType dub

# Enable debug mode
ani-cli config set debug true

Features Deep Dive

Multi-Provider Fallback

ani-cli-node uses multiple video providers with automatic fallback:

  1. HiAnime (Primary) - HLS streaming with multiple qualities
  2. Wixmp - HLS/MP4 streams
  3. YouTube - Direct MP4 links
  4. SharePoint - Direct downloads

If one provider fails, it automatically tries the next until a working stream is found.

Watch History

  • Automatically tracks watched episodes
  • Resume from where you left off with --continue
  • View history with ani-cli history
  • Stores in %LOCALAPPDATA%\ani-cli-node\history.json

Quality Selection

Supports automatic quality detection from HLS streams:

  • Best: Highest available quality
  • Worst: Lowest quality (for slow connections)
  • 1080p, 720p, 480p, 360p: Specific resolution preference

Episode Ranges

Watch multiple episodes sequentially:

# Single episode
ani-cli "naruto" -e 150

# Range of episodes
ani-cli "naruto" -e 150-160

# Continues to next episode automatically

Project Structure

ani-cli-node/
├── src/
│   ├── api/          # AllAnime GraphQL API client
│   ├── cli/          # CLI commands, prompts, and UI
│   ├── models/       # Data models (Anime, Episode, Stream)
│   ├── player/       # Media player integration (MPV, VLC)
│   ├── providers/    # Video source providers
│   ├── storage/      # Configuration and history management
│   ├── streaming/    # M3U8 parsing and quality selection
│   ├── types/        # TypeScript type declarations
│   ├── utils/        # Utilities (logger, cache, validators)
│   └── index.ts      # Main entry point
├── bin/              # Executable entry point
├── dist/             # Compiled JavaScript (generated)
└── tests/            # Tests

Development

Build from Source

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run in development mode
npm run dev

# Watch mode (auto-rebuild on changes)
npm run watch

Run Locally Without Installing

# Using tsx (development)
npm run dev

# Using built version
node dist/index.js "anime name"

Debugging

Enable debug mode to see detailed logs:

ani-cli "anime name" --debug

Or set it permanently:

ani-cli config set debug true

Troubleshooting

"No media player detected"

Solution: Install MPV or VLC:

If installed but not detected, set the path manually:

ani-cli config set playerPath "C:\Program Files\mpv\mpv.exe"

"No results found"

Possible causes:

  • Typo in anime name
  • Anime not available on AllAnime API
  • Network issues

Solution: Try alternative search terms or check internet connection

"No working providers available"

Possible causes:

  • Episode not yet available
  • All video sources temporarily down
  • Network/firewall blocking requests

Solution:

  • Try again later
  • Check firewall settings
  • Try with --debug to see which providers are failing

Player won't launch

Checklist:

  1. Verify player is installed: mpv --version or vlc --version
  2. Check PATH or set custom player path
  3. Try specifying player: ani-cli "anime" -p mpv

Windows Firewall Blocking

If Windows Defender blocks network requests:

  1. Allow Node.js through firewall
  2. Allow MPV/VLC through firewall
  3. Disable antivirus temporarily to test

Comparison with Original ani-cli

Feature Original ani-cli ani-cli-node
Platform Linux/macOS (Git Bash on Windows) Windows-native (cross-platform)
Language Shell script TypeScript/Node.js
Dependencies curl, grep, sed, fzf npm packages only
Setup Manual script installation npm install
IDE Support Limited Full TypeScript support
Debugging Shell debugging Proper debug mode & logging
Updates Git pull npm update
Downloads ✅ (with yt-dlp) ❌ (streaming only)

Known Limitations

  • No download support (streaming only) - may be added in future
  • Requires external player (MPV/VLC)
  • AllAnime API dependency - if API changes, tool may break
  • No intro skipping (original ani-cli has ani-skip integration)
  • No syncplay support for group watching

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Areas for Improvement

  • Add download functionality
  • Implement intro skipping
  • Add support for more video players
  • Improve error handling
  • Add unit tests
  • Add CI/CD pipeline

License

MIT License - see LICENSE file for details

Credits

  • Original ani-cli by pystardust
  • AllAnime API for anime metadata
  • All the amazing npm package maintainers

Disclaimer

This tool is for educational purposes only. Please support the anime industry by watching through official legal streaming services when available.


Made with ❤️ and TypeScript

Stream anime from your terminal, the modern way.

About

Clone of the ani-cli in typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published