GithubHelp home page GithubHelp logo

fabiospampinato / cliflix Goto Github PK

View Code? Open in Web Editor NEW
1.5K 25.0 65.0 6.98 MB

Watch anything instantaneously, just write its name.

License: MIT License

TypeScript 99.48% JavaScript 0.52%
watch stream torrent cli cliflix

cliflix's Introduction

CLIFlix

Watch anything instantaneously, just write its name.

It searches a torrent for you and streams it using WebTorrent to your favorite app. It supports subtitles too.

Warning: If you don't know what a torrent is, or are unsure about the legality of the torrents you're downloading you shouldn't use cliflix.

Install

$ npm install -g cliflix

Usage

Wizard

Execute cliflix to run a wizard, it'll ask you everything it needs: a search query, which torrent to stream, and which app to use. If you want it may also search for subtitles for you.

Wizard

I'm Feeling Lucky

If you're feeling lucky, just run something like this to automatically pick the first result:

cliflix Sintel

Manual

You can also directly pass any of the valid torrent identifiers supported by parse-torrent to stream it:

cliflix "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent"

WebTorrent Options

You can pass arbitrary options to WebTorrent, read more about them here. Just write them after the special -- argument:

cliflix -- --iina --pip
cliflix -- --vlc --port 1234
cliflix Sintel -- --vlc --port 1234

Configuration

You can customize cliflix to your likings via a ~/.cliflix.json file.

These are the settings available:

{
  "downloads": { // Downloads-related settings
    "path": "~/Downloads", // If saving them, put them here
    "save": true // Save the downloaded torrents or delete them upon exit
  },
  "outputs": { // Apps-related settings
    "available": ["Airplay", "Chromecast", "DLNA", "MPlayer", "mpv", "VLC", "IINA", "XBMC"], // Apps to list when asking for the app
    "favorites": ["VLC"] // Favorite apps, they will be listed before the others
  },
  "torrents": { // Torrents-related settings
    "limit": 30, // Number of torrents to show
    "details": { // Extra columns to show
      "seeders": true,
      "leechers": true,
      "size": true,
      "time": false
    },
    "providers": { // Torrents providers-related settings
      "available": ["1337x", "ThePirateBay", "ExtraTorrent", "Rarbg", "Torrent9", "KickassTorrents", "TorrentProject", "Torrentz2"], // Providers to list if none is active
      "active": "1337x" // Active provider
    }
  },
  "subtitles": { // Subtitles-related settings
    "limit": 30, // Number of subtitles to show
    "details": { // Extra columns to show
      "downloads": true
    },
    "languages": { // Languages-related settings
      "available": ["Afrikaans", "..."], // Languages to list when asking for the subtitles' language
      "favorites": ["English", "..."] // Favorite languages, they will be listed before the others
    },
    "opensubtitles": { // OpenSubtitles-related settings
      "username": null, // Your OpenSubtitles username, required for increasing your IP quota
      "password": null, // Your OpenSubtitles password, required for increasing your IP quota
      "ssl": true
    }
  },
  "webtorrent": { // WebTorrent-related options
    "options": [ // Custom options to always pass to WebTorrent
      '--keep-seeding'
    ]
  }
}

License

MIT © Fabio Spampinato

cliflix's People

Contributors

fabiospampinato avatar hp4k1h5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cliflix's Issues

[DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

Receiving the following error when running cliflix.

(node:17435) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
$ npm version
{
  npm: '7.7.5',
  node: '12.18.2',
  v8: '7.8.279.23-node.39',
  uv: '1.38.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.16.1',
  modules: '72',
  nghttp2: '1.41.0',
  napi: '6',
  llhttp: '2.0.4',
  http_parser: '2.9.3',
  openssl: '1.1.1f',
  cldr: '37.0',
  icu: '67.1',
  tz: '2021a',
  unicode: '13.0'
}

Crash when downloading subtitles

Everything works perfectly without selecting subtitles, but when I say yes to Do you want subtitles prompt and select subtitles I am getting this output and program crashes.

? Which language? English
? Which subtitles? Being John Malkovich (1999) Criterion BluRay 1h 53m 18s @23.976fps.English
? Which app? (Use arrow keys)
❯ VLC
──────────────
Airplay
Chromecast
DLNA
MPlayer
mpv
IINA
XBMC
events.js:177
throw er; // Unhandled 'error' event
^

Error: ENOENT: no such file or directory, open '/.downloads/Being John Malkovich (1999) Criterion BluRay 1h 53m 18s @23.976fps.English.srt'
Emitted 'error' event at:
at /usr/local/lib/node_modules/cliflix/node_modules/graceful-fs/graceful-fs.js:228:14
at /usr/local/lib/node_modules/cliflix/node_modules/graceful-fs/graceful-fs.js:258:16
at FSReqCallback.oncomplete (fs.js:153:23) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '
/.downloads/Being John Malkovich (1999) ' +
'Criterion BluRay 1h 53m 18s ' +
'@23.976fps.English.srt'
}

Stuck at searching

Cliflix ask what to watch. I enter something. Then nothing happens, it just stuck doing nothing ( or displaying nothing) forever ( or at least hour).
https://i.imgur.com/AnRKQwy.png
is there any debug mode or logs to pinpoint the problem?

Fast launch MacOS PiP

Hey! Awesome project, i like it 😎

What do you think of using https://github.com/albinekb/open-pip-cli with this? What's the best way I could support streaming from watch?

$ watch "Rick and morty" | open-pip
$ watch "Rick and morty" | open VLC.app

The cli would just spit out the streaming URL to stdout, making it possible to use different apps to view the video.

maybe a flag to make it spit out the URL or use a different player? Just thinking.. 👍 any ideas?

[BUG] Size not shown

image

My config:

{
  "downloads": { // Downloads-related settings
    "path": "~/Downloads/video/cliflix", // If saving them, put them here
    "save": true // Save the downloaded torrents or delete them upon exit
  },
  "outputs": { // Apps-related settings
    "available": ["Airplay", "Chromecast", "DLNA", "MPlayer", "mpv", "VLC", "IINA", "XBMC"], // Apps to list when asking for the app
    "favorites": ["mpv"] // Favorite apps, they will be listed before the others
  },
  "torrents": { // Torrents-related settings
    "limit": 30, // Number of torrents to show
    "details": { // Extra columns to show
      "seeders": true,
      "leechers": true,
      "size": true,
      "time": true
    },
    "providers": { // Torrents providers-related settings
      "available": ["1337x", "ThePirateBay", "ExtraTorrent", "Rarbg", "Torrent9", "KickassTorrents", "TorrentProject", "Torrentz2"], // Providers to list if none is active
      "active": "1337x" // Active provider
    }
  },
  "subtitles": { // Subtitles-related settings
    "limit": 30, // Number of subtitles to show
    "details": { // Extra columns to show
      "downloads": true
    },
    "languages": { // Languages-related settings
      "available": ["Afrikaans", "..."], // Languages to list when asking for the subtitles' language
      "favorites": ["English", "..."] // Favorite languages, they will be listed before the others
    },
    "opensubtitles": { // OpenSubtitles-related settings
      "username": null, // Your OpenSubtitles username, required for increasing your IP quota
      "password": null, // Your OpenSubtitles password, required for increasing your IP quota
      "ssl": true
    }
  },
  "webtorrent": { // WebTorrent-related options
    "options": [ // Custom options to always pass to WebTorrent
    ]
  }
}

Stuck on searching

Stuck on Waiting for "1337x"... and Ctrl+C can't exit, my network can go to 1337x site and search. I try to change the provider, but it's the same.

mpv doesn't open automatically when selected through the prompt after running `watch`, but does when running `watch -- --mpv`

Hi,

So if I type just watch in the command line, go through the prompts, and select mpv on the last step, the streaming server will start but mpv doesn't automatically open and connect. If I manually start mpv, it connects to the server fine.

When I type watch -- --mpv, mpv starts automatically upon selecting a download.

A similar thing happens with VLC. VLC opens and plays automatically when it's specified in the first command, but when I select it through the prompts it opens but doesn't play automatically. I suspect that this issue might have to deal with webtorrent, and not watch.

I have both VLC and mpv installed with Homebrew Cask.

mpv:

mpv 0.26.0 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
 built on Mon Jul 24 16:20:40 CEST 2017
ffmpeg library versions:
   libavutil       55.58.100
   libavcodec      57.89.100
   libavformat     57.71.100
   libswscale      4.6.100
   libavfilter     6.82.100
   libswresample   2.7.100
ffmpeg version: 3.3.2

Running on a MacBook Pro, Early 2015. macOS Sierra 10.12.6. Shell is zsh.

Tilde path expansion

It downloads to /usr/local/lib/node_modules/cliflix/~/Downloads/video/cliflix/ with "path": "~/Downloads/video/cliflix", // If saving them, put them here.

?

Bypass leaf signature
install git

Otherwise cliflix does not works.

Show the size of torrents

It was a pleasure using this tool but in addition to the column for the number of peers, please also add a column indication each item's size.

Cliflix cat't start - /usr/bin/env: - no such file error

Ubuntu 20.04.3 LTS
Node v14.17.2

Cliflix produces error on start -

/usr/bin/env: ‘node --no-deprecation’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

all other globally installed modules work as usual

UTF-8 Turkish Charachter Problem

I submitted issue liked this months ago but I wasn't able to make tests and share that time apologize for that, finally I decided to submit this issue properly.

Problem : UTF-8 Turkish charachters doesn't look like proper on every player(mpv,vlc etc.) with only cliflix.

Experiment:
With cliflix, subtitles was look like this:
https://ibb.co/c6M74TT

Then I used same resources(a video file which is directly downloaded by cliflix but I used SAME subtitle file but this time I downloaded it manually from opensubtitles.org ) and executed them with this command:

mpv video-file-downloaded-by-cliflix --sub-file same-subfile-downloaded-manually-from-opensub

and subtitles was proper this time. https://ibb.co/RB5nJ4B

The problem is valid for every torrent(tested with several torrents). I think problem is originated from opensubtitle api because when I downloaded subfile manually subtitles was proper, how can we fix it for Turkish and other UTF-8 users ?

Apologize for typos I am not native English speaker.

Support selecting Chromecast device

Returns following error.

Error: Chromecast: getaddrinfo ENOTFOUND ba172551-9399-4b27-3968-29f0b88dd4ca.local ba172551-9399-4b27-3968-29f0b88dd4ca.local:8009
(node:28952) UnhandledPromiseRejectionWarning: Error: null
at Function.module.exports.sync (/home/trisimix/node_modules/execa/index.js:303:26)
at Object. (/home/trisimix/node_modules/cliflix/dist/index.js:253:23)
at step (/home/trisimix/node_modules/cliflix/dist/index.js:33:23)
at Object.next (/home/trisimix/node_modules/cliflix/dist/index.js:14:53)
at /home/trisimix/node_modules/cliflix/dist/index.js:8:71
at new Promise ()
at __awaiter (/home/trisimix/node_modules/cliflix/dist/index.js:4:12)
at Object.stream (/home/trisimix/node_modules/cliflix/dist/index.js:245:16)
at Object. (/home/trisimix/node_modules/cliflix/dist/index.js:99:33)
at step (/home/trisimix/node_modules/cliflix/dist/index.js:33:23)
at Object.next (/home/trisimix/node_modules/cliflix/dist/index.js:14:53)
at fulfilled (/home/trisimix/node_modules/cliflix/dist/index.js:5:58)
(node:28952) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:28952) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Freezing when playing to chromecast

Tv starts, video plays for like 2 seconds, then audio & video freezes and never starts again even though the download continues and finishes. Same thing with any movie I select, download speed is high and good router with close distance (no walls) used.. How to fix this?

TypeError: Buffer.alloc is not a function

Ubuntu 16.04

#node --version
v4.2.6

watch
/usr/local/lib/node_modules/@fabiospampinato/watch/node_modules/parse-torrent/index.js:110
;(function () { Buffer.alloc(0) })()
^

TypeError: Buffer.alloc is not a function
at /usr/local/lib/node_modules/@fabiospampinato/watch/node_modules/parse-torrent/index.js:110:24
at Object. (/usr/local/lib/node_modules/@fabiospampinato/watch/node_modules/parse-torrent/index.js:110:35)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/@fabiospampinato/watch/dist/index.js:40:20)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/@fabiospampinato/watch/dist/cli.js:44:10)

Support for changing query

Hi Fabio,

I have a branch to select the next provider during torrent searching. The use case is if the torrent is not relevant (seed / leech not sufficient or quality ...) on a provider, the user could select another provider.

Could I open a pull request to have your opinion?

Thanks for the cliflix ! Good job
Vincent.

SyntaxError on Node 5.5

v5.5.0
fiatjaf@luke ~ [2]> ~/node_modules/bin/watch 'Jardim das Aflições'

Command failed: /bin/sh -c ./node_modules/.bin/magnet --rows 10 "Jardim das Aflições" 1
/home/fiatjaf/node_modules/lib/node_modules/@fabiospampinato/watch/node_modules/magnet-cli/app.js:24
let argv = minimist(process.argv.slice(2), {'--': true})
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:139:18)
    at node.js:999:3

Invalid torrent identifier

I get this for every torrent I pick:

(node:10754) Warning: N-API is an experimental feature and could change at any time.
Error: Invalid torrent identifier

UNEXPECTED ERROR: If this is a bug in WebTorrent, report it!
OPEN AN ISSUE: https://github.com/webtorrent/webtorrent-cli/issues

DEBUG INFO: webtorrent-cli 1.11.0, webtorrent 0.102.4, node v8.11.3, darwin x64, exit 1
(node:10749) UnhandledPromiseRejectionWarning: Error: null
    at Function.module.exports.sync (/Users/stjepangolemac/.config/yarn/global/node_modules/execa/index.js:303:26)
    at Object.<anonymous> (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:202:23)
    at step (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:33:23)
    at Object.next (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:14:53)
    at /Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:4:12)
    at Object.stream (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:194:16)
    at Object.<anonymous> (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:104:33)
    at step (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:33:23)
    at Object.next (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:14:53)
    at fulfilled (/Users/stjepangolemac/.config/yarn/global/node_modules/cliflix/dist/index.js:5:58)
    at <anonymous>
(node:10749) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:10749) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Tilde expansion

if you use a ~ to set downloads.path in the config, cliflix will download to its local node_modules subdirectory.

example config: {"downloads": {"path": "~/Downloads"}}

Expected result: downloads to be in $HOME/Downloads
Actual result: downloads to path/to/global_node_modules/cliflix/~/Downloads

i believe a special handler is needed when options are loaded and _.merge()'d

_.mergeWith ( Config, localConfig, ( prev, next ) => {

id be happy to submit a pr if you are accepting

Indicate ongoing operations

It'd be nice to have some kind of indication (npm-style spinner maybe or just plain text) while there are ongoing actions (e.g. searching for subtitles) so it's clear that something's going on and you just have to wait for it to complete.

By the way, great tool!

No search results

Hi,

I just installed cliflix, tried to search for "Tears of Steel" as in the gif demo, but I'm always getting No titles found for "Tears of Steel", try again. for any search query.

Is it something in the config I need to add?

utf-8 Subtitle problem

When I choose Turkish subtitles Turkish charachters(ç,ö,ş,ü,İ) are look like question mark in triangle, I tested it with mpv and VLC, also downloaded the subtitle myself and tested it there were no problem.

There may be a bug in latest version

Hello!! I've just downloaded and installed cliflix following the guide in the readme file and when I wanted to start watching a movie I got stopped by a bug.

The debug info says that in the file and line
/usr/local/lib/node_modules/cliflix/node_modules/webtorrent/lib/server.js:81
const pathname = new URL(req.url, 'http://example.com').pathname

There's a ReferenceError because URL is undefined.

Thank you in advance..

"Feeling Lucky" Attempts to play non video files

The "Feeling Lucky" feature sometimes attempts to play non video files. This just downloads the file without playing anything. Its also possible to select a non video file to play and it hangs.

SyntaxError: Unexpected token

After fresh installation on osx 10.4:

MacBook-Pro-Kamil:~ kamil$ cliflix
/usr/local/lib/node_modules/cliflix/node_modules/torrent-search-api/lib/TorrentProvider.js:240
    return req({ ...opts, followRedirect: false }).then(response => {
                 ^^^
SyntaxError: Unexpected token ...
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/cliflix/node_modules/torrent-search-api/lib/ProviderManager.js:4:25)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.