Cthulhu is a simple python CLI application that streams torrents directly from 1337x.

Related tags

CLI Tools cthulhu
Overview

Cthulhu

Cthulhu is a simple python CLI application that facilitates the streaming of torrents directly from 1337x. It uses webtorrent to stream video from magnet links directly.

Video Preview

Cthulhu is heavily inspired by Bugswriter's notflix, which was written using shell scripting. The differences between our programs aren't very stark. All in all, I wrote this program mainly for fun and practice.

Feel free to submit issues and feature requests.

Notable Features (so far)

  • Runs in the terminal
  • Flags for filtering results by specific categories (Movies, TV Shows, Anime)
  • Filtering out unwanted results by default, such as application files and pornogrophy

Requirements

  • mpv - A feature rich media player
  • lxml - A python library for parsing XML/HTML. pip install lxml
  • peerflix - A tool to stream torrents. npm install -g peerflix

Installation for Linux/macOS

cURL

cURL cthulhu to your $PATH and give execute permissions.

sudo curl -sL "https://raw.githubusercontent.com/trianglecirclexyz/cthulhu/main/cthulhu" -o /usr/local/bin/cthulhu
sudo chmod +x /usr/local/bin/cthulhu
  • To update, just do curl again, no need to chmod anymore.
  • To uninstall, remove cthulhu from your $PATH, for example sudo rm -f /usr/local/bin/cthulhu.
Comments
  • MPV error on Launch

    MPV error on Launch

    I am on MacOS and have had mpv installed and working for a long time.

    When I run cthulhu, it spits out an error indicating I do not have mpv installed.

    note: In actual fact I have mpv and a MacOS fork of mpv that basically makes mpv a gui app on a mac. Both work perfectly.

    opened by drewauff 8
  • Expand to other torrent sources

    Expand to other torrent sources

    Thanks for this tool, I was actively looking for exactly that some weeks ago, glad to find it on r/commandline today!

    In Stremio, a GUI application that does similar things, Torrentio is a major source for torrents and seems to simply be the best for most movies or TV shows in terms of seeds and leechers, at least for 4K. Would it be feasible to expand cthulhu so that it can fetch magnets from Torrentio too (and possibly others in the future)?

    opened by Kabouik 6
  • Allow selecting files in torrent, useful for TV shows

    Allow selecting files in torrent, useful for TV shows

    Currently cthulhu automatically uses peerflix -a, which downloads all files. It is a problem for TV shows whose episodes are all bundled into the same torrent. peerflix -l seems to cover exactly that case (although it doesn't allow multi-selection, unfortunately), and same with webtorrent -s (a little bit less convenient). Wouldn't it make sense to make an option (and perhaps use -a as default) so that users can use -l/-s instead and decide which episode to stream when several are bundled together?

    Ideally there could be a prompt asking whether to download all files or just one after a torrent has been selected, because the user can't know in advance which torrents would be available. Specifying the option when executing cthulhu would skip that prompt.

    opened by Kabouik 2
  • Minor cosmetic and syntax changes

    Minor cosmetic and syntax changes

    This is a very minor PR, but I did those changes locally and thought you could decide if you want them or not. No hard feelings if not, and sorry if you don't accept PR.

    Ideally I would have liked adding a way to fetch the 20 previous or next results, but I'm not skilled in Python and was not sure how to do that (maybe enclose everything in a function and increment display_count by ±20?).

    Other things I noticed:

    • peerflix dependency check could be useful (after selecting a torrent, so that one can still use cthulhu to print magnets. Could be extended to webtorrent as an optional dependency if it is added as a fallback in the future.
    • requests dependency check would be useful too.
    • mpv and vlc dependency checks should not be hardcoded paths, because this will not work on distributions like GNU Guix or other distributions where those binaries would be installed with the distro-agnostic Guix package manager. Same issue of course with peerflix whose path will depend on the Node version, or with locally compiled mpv which would likely end up in ~/.local/bin/. Answers here may solve the issue by checking executables in $PATH instead of hardcoded paths, which would also allow checking whether peerflix is installed regardless of the Node version.
    • Line 79: should it not be if 'no-clean' not in parsed_args? The way I understand it right now, it seems to delete the temporary folder if --no-clean is supplied.
    opened by Kabouik 1
  • Add request checking

    Add request checking

    Module requests not include in standard library. May be checking will be helpful.

    try:
        import requests
    except ImportError:
        print('error: requests is not installed (hint: pip install requests)')
        exit()
    
    opened by AleksandrRasskazov 1
  • Adds support for additional sources

    Adds support for additional sources

    Refactored code to allow for adding new sources. They can be added as new classes and must contain get_responses(), parse_responses(), and get_magnet_link() functions.

    I also removed filter flags since they are not source-agnostic, but I might re-add them later.

    Sources can be selected using --source or -s flags.

    Usage: cthulhu --source <source> [other options] [query]

    Current available sources:

    • 1337x (default)
    • Nyaa
    opened by trianglecirclexyz 0
  • Search results differ with a new version of `cthulhu`, despite using the same source

    Search results differ with a new version of `cthulhu`, despite using the same source

    See this example where I could find Better Call Saul S06E01 with an older version of cthulhu, but it would fail when entering the ID, and after update S06E01 is not found anymore:

    
    kabouik@solus ~  $ cthulhu -s 1337x
    
    Source: 1337x
    Please make sure your query contains at least 3 characters
    
    Enter search query: better call saul s06e01
    Fetching torrents…
    
     ID	   S/L		Size		Torrent name
      1	3944/1508 	3.8 GB  	Better.Call.Saul.S06E01.1080p.WEB.H264-GLHF
      2	1409/273  	554.3 MB  	Better.Call.Saul.S06E01.WEBRip.x264-ION10
      3	1395/377  	3.8 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.AMZN.WEBRip.DDP5.1.x264-NTb
      4	1045/506  	1.7 GB  	Better.Call.Saul.S06E01.720p.WEB.H264-GLHF
      5	 969/349  	2.5 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.NF.WEBRip.DDP5.1.x264-NTb
      6	 805/683  	249.2 MB  	Better.Call.Saul.S06E01.720p.WEB.x265-MiNX[TGx]
      7	 509/215  	3.8 GB  	Better.Call.Saul.S06E01.1080p.WEB.H264-GLHF[TGx]
      8	 453/117  	336.8 MB  	Better.Call.Saul.S06E01.WEB.x264-PHOENiX
      9	 299/90   	1.4 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.NF.WEBRip.DDP5.1.x264-NTb
     10	 275/69   	1.7 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.AMZN.WEBRip.DDP5.1.x264-NTb
     11	 177/314  	584.1 MB  	Better.Call.Saul.S06E01.1080p.HEVC.x265-MeGusta[TGx]
     12	 154/47   	3.8 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[TGx]
     13	 120/28   	2.5 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.NF.WEBRip.DDP5.1.x264-NTb[TGx]
     14	 119/64   	1.7 GB  	Better.Call.Saul.S06E01.720p.WEB.H264-GLHF[TGx]
     15	  57/20   	4.0 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.AMZN.WEBMux.ITA.ENG.DD5.1.x264-BlackBit.mkv
     16	  43/12   	1.4 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.NF.WEBRip.DDP5.1.x264-NTb[TGx]
     17	  37/14   	1.7 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.AMZN.WEBRip.DDP5.1.x264-NTb[TGx]
     18	  30/12   	479.3 MB  	Better.Call.Saul.S06E01.XviD-AFG[TGx]
    
    Select by ID: 3               
    Invalid torrent identifier
    Cleaning /tmp/torrent-stream cache (~0.0B)…
    
    kabouik@solus ~  $ cthulhu -s 1337x
    
    Source: 1337x
    Please make sure your query contains at least 3 characters
    
    Enter search query: better call saul s06e01
    Fetching torrents…
    
     ID	   S/L		Size		Torrent name
      1	3944/1508 	3.8 GB  	Better.Call.Saul.S06E01.1080p.WEB.H264-GLHF
      2	1409/273  	554.3 MB  	Better.Call.Saul.S06E01.WEBRip.x264-ION10
      3	1395/377  	3.8 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.AMZN.WEBRip.DDP5.1.x264-NTb
      4	1045/506  	1.7 GB  	Better.Call.Saul.S06E01.720p.WEB.H264-GLHF
      5	 969/349  	2.5 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.NF.WEBRip.DDP5.1.x264-NTb
      6	 805/683  	249.2 MB  	Better.Call.Saul.S06E01.720p.WEB.x265-MiNX[TGx]
      7	 509/215  	3.8 GB  	Better.Call.Saul.S06E01.1080p.WEB.H264-GLHF[TGx]
      8	 453/117  	336.8 MB  	Better.Call.Saul.S06E01.WEB.x264-PHOENiX
      9	 299/90   	1.4 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.NF.WEBRip.DDP5.1.x264-NTb
     10	 275/69   	1.7 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.AMZN.WEBRip.DDP5.1.x264-NTb
     11	 177/314  	584.1 MB  	Better.Call.Saul.S06E01.1080p.HEVC.x265-MeGusta[TGx]
     12	 154/47   	3.8 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[TGx]
     13	 120/28   	2.5 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.NF.WEBRip.DDP5.1.x264-NTb[TGx]
     14	 119/64   	1.7 GB  	Better.Call.Saul.S06E01.720p.WEB.H264-GLHF[TGx]
     15	  57/20   	4.0 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.1080p.AMZN.WEBMux.ITA.ENG.DD5.1.x264-BlackBit.mkv
     16	  43/12   	1.4 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.NF.WEBRip.DDP5.1.x264-NTb[TGx]
     17	  37/14   	1.7 GB  	Better.Call.Saul.S06E01.Wine.and.Roses.720p.AMZN.WEBRip.DDP5.1.x264-NTb[TGx]
     18	  30/12   	479.3 MB  	Better.Call.Saul.S06E01.XviD-AFG[TGx]
    
    Select by ID: 1
    Invalid torrent identifier
    Cleaning /tmp/torrent-stream cache (~0.0B)…
    
    kabouik@solus ~  $ z cth
    
    kabouik@solus ~/P/cthulhu  $ git pull                                              
    remote: Enumerating objects: 2ne
    remote: Counting objects: 100% (24/24), done.
    remote: Compressing objects: 100% (17/17), done.
    remote: Total 21 (delt
    Unpacking objects: 100% (21/21), 4.13 KiB | 302.00 KiB/s, done.
    From https://github.com/trianglecirclexyz/cthulhu
       6b77e49..695071c         -> origin/
    Updating 6b77e71
    Fast-forward
     README.md | 4 ++--
     cthulhu   | 8 ++++----
     2 files changed, 6 insertions(+), 6 deletions(-)
    
    kabouik@solus ~/P/cthulhu  $ kak README.md                                                                                                                                                                                                                          
    
    kabouik@solus ~/P/cthulhu  $ which cthulhu  
    /home/kabouik/.local/bin/cthulhu
    
    kabouik@solus ~/P/cthulhu  $ cthulhu -s 1337x 
    Source: 1337x
    Please make sure your query contains at least 3 characters
    
    Enter search query: better call saul s06e01
    Fetching torrents…
    
    No results found.
    
    
    kabouik@solus ~/P/cthulhu  $ cthulhu -s 1337x 
    Source: 1337x
    Please make sure your query contains at least 3 characters
    
    Enter search query: better call saul
    Fetching torrents…
    
     ID	   S/L		Size		Torrent name
      1	2267/148  	216.4 MB  	Better.Call.Saul.S04E07.HDTV.x264-SVA[eztv]
      2	2217/207  	857.5 MB  	Better.Call.Saul.S04E03.720p.HDTV.x264-KILLERS [rarbg]
      3	1907/96   	247.1 MB  	Better.Call.Saul.S04E05.HDTV.x264-SVA[eztv]
      4	1739/154  	206.7 MB  	Better.Call.Saul.S04E06.HDTV.x264-SVA[eztv]
      5	1533/70   	307 MB  	Better.Call.Saul.S04E10.HDTV.x264-SVA [rarbg]
      6	1512/145  	204.5 MB  	Better.Call.Saul.S04E02.HDTV.x264-SVA[eztv]
      7	1499/115  	830.5 MB  	Better.Call.Saul.S04E07.720p.HDTV.x264-AVS[eztv]
      8	1309/67   	231.8 MB  	Better.Call.Saul.S04E04.HDTV.x264-SVA[eztv]
      9	1199/91   	255.5 MB  	Better Call Saul S04E08 HDTV x264-SVA [eztv]
     10	1146/96   	803.8 MB  	Better.Call.Saul.S04E02.720p.HDTV.x264-AVS[eztv]
     11	1082/118  	1.9 GB  	Better.Call.Saul.S05E08.1080p.WEB.H264-XLF[TGx] ⭐
     12	1014/39   	1017.2 MB  	Better.Call.Saul.S04E08.720p.HDTV.x264-AVS [rarbg]
     13	1008/254  	1 GB  	Better.Call.Saul.S05E10.720p.WEBRip.x264-XLF[TGx] ⭐
     14	 927/289  	575.5 MB  	Better.Call.Saul.S05E03.WEB.H264-XLF[ettv]
     15	 917/284  	1.6 GB  	Better.Call.Saul.S05E02.1080p.WEB.H264-XLF[TGx] ⭐
     16	 901/55   	231.9 MB  	Better.Call.Saul.S04E01.HDTV.x264-SVA[eztv]
     17	 894/88   	225.6 MB  	Better.Call.Saul.S04E03.HDTV.x264-KILLERS[eztv]
     18	 880/98   	1014.9 MB  	Better.Call.Saul.S04E05.720p.HDTV.x264-AVS[eztv]
     19	 843/82   	632.2 MB  	Better.Call.Saul.S05E09.WEB.H264-XLF[ettv]
     20	 827/41   	225.6 MB  	Better.Call.Saul.S04E03.HDTV.x264-KILLERS [rarbg]
    
    Select by ID: ^C Interrupted.
    
    kabouik@solus ~/P/cthulhu  $ cthulhu -s 1337x 
    Source: 1337x
    Fetching torrents…
    
    No results found.
    
    
    kabouik@solus ~/P/cthulhu  $ cthulhu                                            
    Enter search query: ^C Inteed
    
    kabouik@solus ~/P/cthulhu  $ cthulhu --help   
    Usage: cthulhu [options] search-query
    
    Options:
     -s, --source   	Changes to specified source
     --no-clean     	Avoids deleting the torrent cache
     --get-magnet   	Prints the torrent magnet link
     -l, --list     	Lists all files in a torrent for selection
     --vlc          	Sets the player to vlc
    
    Sources:
     1337x
     nyaa
    
    
    kabouik@solus ~/P/cthulhu  $ cthulhu -s 1337x 
    Source: 1337x
    Please make sure your query contains at least 3 characters
    
    Enter search query: better call saul s06e01
    Fetching torrents…
    
    No results found.
    

    My ~/.local/bin/cthulhu is a symbolic link to the executable in the git folder.

    opened by Kabouik 0
Owner
Raiyan
Raiyan
A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool

Privateer A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool How

Shreyash Chavan 2 Apr 4, 2022
CryptoCo-py is a Python CLI application that uses CoinGecko API to allow the user to query cryptocurrency information by typing simple commands.

CryptoCo-py is a Python CLI application that uses CoinGecko API to allow the user to query cryptocurrency information by typing simple com

null 1 Jan 10, 2022
A simple CLI application helps you to find giant files that are eating up your system storage

Large file finder Sometimes it's very hard to find if some giant files are eating up your system storage. We might need to hunt those down. This simpl

Rahul Baruri 5 Nov 18, 2022
Python-Stock-Info-CLI: Get stock info through CLI by passing stock ticker.

Python-Stock-Info-CLI Get stock info through CLI by passing stock ticker. Installation Use the following command to install the required modules at on

Ayush Soni 1 Nov 5, 2021
Yts-cli-streamer - A CLI movie streaming client which works on yts.mx API written in python

YTSP It is a CLI movie streaming client which works on yts.mx API written in pyt

null 1 Feb 5, 2022
👻 Ghoul is an easy to use information service, allowing you to get/add information on someone or something directly from your terminal.

?? Ghoul is an easy to use information service, allowing you to get/add information on someone or something directly from your terminal. It c

Billy 11 Nov 10, 2021
Generate folder trees directly from the terminal.

Dir Tree Artist ?? ?? Intro Easily view folder structure, with parameters to sieve out what you want. Choose to exclude files from being viewed (.git,

Glenda T 0 May 17, 2022
Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git C

Yash Thakre 16 May 29, 2022
flora-dev-cli (fd-cli) is command line interface software to interact with flora blockchain.

Install git clone https://github.com/Flora-Network/fd-cli.git cd fd-cli python3 -m venv venv source venv/bin/activate pip install -e . --extra-index-u

null 14 Sep 11, 2022
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
[WIP]An ani-cli like cli tool for movies and webseries

mov-cli A cli to browse and watch movies. Installation This project is a work in progress. However, you can try it out python git clone https://github

null 166 Dec 30, 2022
Doro is a CLI based pomodoro app and countdown timer application built using python.

Doro - CLI based pomodoro app Doro is a CLI based pomodoro app and countdown timer application built using python. Install $ pip install doro Usage Po

Suresh Kumar 14 May 23, 2022
A CLI application for storing contacts as a csv file written in Python.

Contacter A CLI application for storing contacts as a csv file written in Python. You can use this to save your contacts with a special relations tag

nostalgicnerdpenguin 1 Oct 23, 2021
A CLI minesweeper application written in 60 LoC python

This is a CLI minesweeper application written in 60 LoC python. You can use d row,column to dig and f row,column to flag/unflag

null 1 Dec 21, 2021
Python Command Line Application (CLI) using Typer, SQLModel, Async-PostgrSQL, and FastAPI

pyflycli is a command-line interface application built with Typer that allows you to view flights above your location.

Kevin Zehnder 14 Oct 1, 2022
Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process of them.

Task Manager Automation Tool (TMAT) CLI Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process

Tiamat 5 Apr 12, 2022
AutoSub is a CLI application to generate subtitle files (.srt, .vtt, and .txt transcript) for any video file using Mozilla DeepSpeech.

AutoSub About Motivation Installation Docker How-to example How it works TO-DO Contributing References About AutoSub is a CLI application to generate

Abhiroop Talasila 414 Jan 6, 2023
WA Terminal is a CLI application that allows us to login and send message with WhatsApp with a single command.

WA Terminal is a CLI application that allows us to login and send message with WhatsApp with a single command.

Aziz Fikri 15 Apr 15, 2022