Code Monkey home page Code Monkey logo

cthulhu's Introduction

Cthulhu

Cthulhu is a simple python CLI application that facilitates the streaming of torrents directly from various sources. It uses peerflix to stream video from magnet links directly.

Video Preview

Cthulhu is heavily inspired by Bugswriter's notflix, which was written using shell scripting. 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 directly from the terminal
  • macOS and BSD support (theoretical, needs testing)
  • multiple source options (currently: 1337x, nyaa)
  • Ability to list multiple files in a torrent (useful for binging TV shows)
  • Filtering out unwanted results by default, such as application files and pornogrophy

Requirements

  • mpv or vlc
  • requests - A python library for making http requests. pip3 install requests
  • lxml - A python library for parsing XML/HTML. pip3 install lxml
  • peerflix - A tool to stream torrents. npm install -g peerflix

Installation for Linux/macOS

cURL

Make sure that /usr/local/bin exists with the proper permissions. If not, then sudo mkdir -p -m 775 /usr/local/bin

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.

cthulhu's People

Contributors

kabouik avatar nabil-rady avatar trianglecirclexyz 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

Watchers

 avatar

cthulhu's Issues

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()

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.

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)?

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.

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.

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.