Little tool in python to watch anime from the terminal (the better way to watch anime)

Overview

anipy-cli

Little tool in python to watch anime from the terminal (the better way to watch anime)

Has a resume playback function when picking from History

Scrapes: https://gogoanime.wiki

Heavily inspired by https://github.com/pystardust/ani-cli/ but with more features

[Still in development]

Dependencies:

  • Python 3.0

  • BeautifulSoup

  • requests

  • cURL

  • mpv

Usage

Install Dependencies

Get Python from: https://www.python.org/downloads/

Get mpv from: https://mpv.io/installation/

Curl should be preinstalled on Windows, Linux and macOS if not get it from here: https://curl.se/download.html

To install requests do: pip install requests

To install BeautifulSoup do: pip install bs4

Start up

To start anipy-cli

pyton main.py

Options

Set video quality

main.py -q "Your desired quality"

By default ani-py-cli tries to get the best quality avalible. You can spify a quality like so: 360/720/1080... (without the "p" at the end)

You can also use best or worst.

History

main.py -H

This will let you pick one of your anime-episodes that you previously watched and resumes playback at the time you exited the video player.

Delete History

main.py -D

Notes

Resume PLayback

The Resume playback function counts the seconds after the video player is opened and stops when its closed. It stores the value and uses it when -H is called, not when you just play a episode like normal. When you play a episode from History, it will continue to count and adds it to the existing value.

Comments
  • [Restructure Request] Reduce the reliance on the main.py frontend

    [Restructure Request] Reduce the reliance on the main.py frontend

    Hello there. Since this project is going to be somewhat rewritten, I'd like to move away from being forced to use the current CLI frontend (in main.py and littered throughout the codebase, for some reason).

    Right now, the only way to easily use the code and functions in the src folder is to use main.py. What I want is for the code in the src folder to act more like a library that can be used through any python script.

    The end goal for this change is to make an alternative dmenu frontend for this project and to make other alternate frontends easier to create (like the ulauncher version by Dankni).

    I am willing to do all of the work in order to achieve this goal. I just wanted to make sure that you support it. If you do not agree with this vision, I will make a fork of this project to do it.

    opened by Dabbing-Guy 32
  • [Feature request] Use Anime download history to download new episodes

    [Feature request] Use Anime download history to download new episodes

    store anime and episode number of anime users have downloaded. have an extra function that checks all the anime in the history files for new episodes and downloads new available episodes for all anime in history files

    opened by Quicksilver151 32
  • [Suggestion] option for reusing the video player window

    [Suggestion] option for reusing the video player window

    Currently, video player closes after each episode. I know it is intentional as anipy-cli waits for the player to close and then proceeds to fetch another link (in binge mode). In the normal mode it doesn't need to wait for the end of an episode though...

    I think it would be great to have an option for using the same window over and over again (one reason for this feature could be discord streaming, which is locked on a window and closes with it).

    This could be done by prefetching all/specified links (not sure if that's an option though, not sure if they expire or not) and then loading all links into some sort of playlist, which would go to the video player.

    Another option that comes on mind would be creating some sort of a link between the player and anipy-cli and (on user interaction) feed it with new links.

    I know what i'm suggesting is not as simple to perform, but i generally think it would be a greatly appreciated by anyone who likes to watch anime together with friends.

    Thanks for taking your time to read this, even if it may be in vain.

    enhancement 
    opened by XaaRii 16
  • places files in a location with admin privilages?

    places files in a location with admin privilages?

    python3 ./run_anipy_cli.py 
    Traceback (most recent call last):
      File "./run_anipy_cli.py", line 2, in <module>
        from anipy_cli import cli
    ModuleNotFoundError: No module named 'anipy_cli'
    
    opened by Quicksilver151 12
  • Feature Request: Option to download the current episode from episode control menu

    Feature Request: Option to download the current episode from episode control menu

    There are times when the internet connection is unstable and stream keeps buffering. It would be handy if there was an option in the Now Playing menu to download the current episode instead.

    The current workaround is to either print the stream url and use yt-dlp to download the file but then manually rename and move. Or exit the current session and open it in Download Mode and search for the episode to download. Both of which are slight annoyance to accomplish the task.

    opened by Prashanthvsdvn 10
  • More browser compatibility

    More browser compatibility

    Hi again,

    I'm not sure if you want to implement something like this, but this makes it possible to use chrome and chromium for webdrivers.

    What do you think?

    Tested on Linux and Windows, as i have no mac there is no implementation for it, so it defaults to Firefox. Daniel

    opened by Dankni95 10
  • Feature: MyAnimeList support

    Feature: MyAnimeList support

    Adding support for Syncing with MyAnimeList

    This feature enables the user to connect anipy-cli with a MyAnimeList account. The added MAL CLI let's the user:

    • Add Anime to MAL list
    • Delete anime from MAL list
    • List anime in MAL list
    • Manually Map MAL anime to gogo Link
    • Sync MAL list into seasonals
    • Sync seasonals into MAL list
    • Download newest episodes
    • Download all episodes
    • Binge watch newest episodes

    The MAL CLI is almost like the seasonal CLI, but adds some syncing features.

    Other Changes:

    • remove kitsu.py dependencies as we are using GoGo for Season-Search now (no dependencies)
    • seasonals file is formatted pretty now(multi line)
    • when in MAL mode watched EPs are being synced to anime list on MAL

    @sdaqo I tried to test everything and it seems like I got everything working, but like always testing is appreciated <3

    opened by dymattic 9
  • Added options for searching anime by season on kitsu

    Added options for searching anime by season on kitsu

    Added options for searching anime by season on kitsu

    I wanted to have the option to display and select anime by year and season, so the following was implemented:

    1. AnimeInfo Class ( handles the kitsu stuff )
    2. Option to search for anime by season in download_cli method
    3. Same for seasonal_cli
    4. Changed some logic in download_cli so downloads start in bulk after episode selection for multiple shows is done
    opened by dymattic 9
  • Issues with .5 episodes

    Issues with .5 episodes

    I am not sure if this accounts as an bug or an PR. but we need to address how the program interacts with special episodes (usually has an episode numbers with .5 decimal)

    Describe the bug The current program doesn't identify .5 episodes and incorrectly maps the special episodes as regular episodes.

    To Reproduce Steps to reproduce the behavior:

    1. Run program
    2. Search for '86 Part 2' (not the dub)
    3. Select Episode 6
    4. Episode 6.5 starts playing instead

    Expected behavior The program should play regular episode (episode 6) instead of special episode (episode 6.5). If i recall correctly, the URL has an '-5' added to the end.

    Info

    Name: anipy-cli
    Version: 2.4.18
    Summary: Little tool in python to watch anime from the terminal (the better way to watch anime)
    Home-page: https://github.com/sdaqo/anipy-cli
    Author: sdaqo
    Author-email: [email protected]
    License: GPL-3.0
    Location: c:\python310\lib\site-packages
    Requires: better-ffmpeg-progress, bs4, kitsu.py-extended, m3u8, moviepy, pycryptodomex, pypresence, python-dateutil, requests, tqdm
    Required-by:
    

    Platform

    • OS: Windows 10

    Additional context Things I think the program should do

    1. The program maps the regular and .5 episodes correctly
    2. The episode selection UI should indicate presence and allow selection of .5 episodes

    I detected this with 86 first but check with other series with .5 episodes in between. Ideally, gogo should categorize them as special episodes but here we are.

    opened by Prashanthvsdvn 7
  • Program crashes when downloading

    Program crashes when downloading

    Describe the bug downloads fails and program crashes

    To Reproduce Steps to reproduce the behavior:

    1. select download mode or even just use it normally error and output:
    ***Download Mode***
    Downloads are stored in: /home/renderinguser/.local/lib/python3.8/site-packages/anipy_cli/download
    Search: yuusha yamemasu
    [1] Yuusha, Yamemasu
    [2] Yuusha, Yamemasu: Kenshuu Ryokou wa Mokuteki wo Miushinau na
    Enter Number: 1
    Episode [1-11]: 9                                                                                                                                                                                                    
    Traceback (most recent call last):                                                                                                                                                                                   
      File "./run_anipy_cli.py", line 14, in <module>                                                                                                                                                                    
        main()                                                                                                                                                                                                           
      File "./run_anipy_cli.py", line 8, in main                                                                                                                                                                         
        cli.main()                                                                                                                                                                                                       
      File "/home/renderinguser/.local/lib/python3.8/site-packages/anipy_cli/cli.py", line 494, in main                                                                                                                  
        download_cli(args.quality, False)                                                                                                                                                                                
      File "/home/renderinguser/.local/lib/python3.8/site-packages/anipy_cli/cli.py", line 69, in download_cli                                                                                                           
        url_class.stream_url()                                                                                                                                                                                           
      File "/home/renderinguser/.local/lib/python3.8/site-packages/anipy_cli/url_handler.py", line 237, in stream_url
        enc_id = self.aes_encrypt(id, self.key).decode()
      File "/home/renderinguser/.local/lib/python3.8/site-packages/anipy_cli/url_handler.py", line 208, in aes_encrypt
        AES.new(key, self.mode, iv=self.iv).encrypt(
      File "/home/renderinguser/.local/lib/python3.8/site-packages/Cryptodome/Cipher/AES.py", line 232, in new
        return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
      File "/home/renderinguser/.local/lib/python3.8/site-packages/Cryptodome/Cipher/__init__.py", line 79, in _create_cipher
        return modes[mode](factory, **kwargs)
      File "/home/renderinguser/.local/lib/python3.8/site-packages/Cryptodome/Cipher/_mode_cbc.py", line 287, in _create_cbc_cipher
        raise ValueError("Incorrect IV length (it must be %d bytes long)" %
    ValueError: Incorrect IV length (it must be 16 bytes long)
    

    Expected behavior anime downloads sucessfully

    Info Post your output of pip show anipy-cli (ok so, i do have it installed here with pip but i use only the repo directly because the pip version is a bit outdated)

    Name: anipy-cli
    Version: 2.2.12
    Summary: Little tool in python to watch anime from the terminal (the better way to watch anime)
    Home-page: https://github.com/sdaqo/anipy-cli
    Author: sdaqo
    Author-email: [email protected]
    License: GPL-3.0
    Location: /home/renderinguser/.local/lib/python3.8/site-packages
    Requires: tqdm, requests, bs4, pycryptodomex, better-ffmpeg-progress
    Required-by:
    

    if it helps, running which anipy-cli results in

    >which anipy-cli                                                    
    /home/renderinguser/.local/bin/anipy-cli
    

    Platform

    • Ubuntu (linux)
    opened by Quicksilver151 7
  • Fixed Multi Threaded m3u8 Download and added check if file exists before DL

    Fixed Multi Threaded m3u8 Download and added check if file exists before DL

    made quite some changes to the multi threaded downloading of m3u8 playlists. Heavily inspired by this project.

    Requires ffmpeg for mergin downloaded parts now.

    opened by dymattic 7
  • Feature my anime list - Second Attempt

    Feature my anime list - Second Attempt

    This is basically the same as #56 , but with improvements.

    Adding support for Syncing with MyAnimeList

    This feature enables the user to connect anipy-cli with a MyAnimeList account. The added MAL CLI let's the user:

    • Add Anime to MAL list
    • Delete anime from MAL list
    • List anime in MAL list
    • Manually Map MAL anime to gogo Link
    • Sync MAL list into seasonals
    • Sync seasonals into MAL list
    • Download newest episodes
    • Download all episodes
    • Binge watch newest episodes

    The MAL CLI is almost like the seasonal CLI, but adds some syncing features.

    Other Changes:

    • remove kitsu.py dependencies as we are using GoGo for Season-Search now (no dependencies)
    • seasonals file is formatted pretty now(multi line)
    • when in MAL mode watched EPs are being synced to anime list on MAL

    Extra:

    • config populates with default values if no config file exists
    • fixed binge mode in MAL
    • removed confusing output
    opened by dymattic 0
  • Fails to download anime that is only on streamsb

    Fails to download anime that is only on streamsb

    Describe the bug This bug happens when an anime episode on gogo is not actually on the gogo server and needs to be streamed from streamsb. It causes the program to crash when trying to watch it or download it.

    You can also tell that it needs to be streamed from streamsb because that is what happens on gogo.

    Link to episode on gogo: https://gogoanime.gg/cowboy-bebop-dub-episode-15

    To Reproduce Try watching or downloading Cowboy Bebop (Dub) episode 15.

    Expected behavior Normal Operation.

    Info

    Name: anipy-cli
    Version: 2.4.18
    Summary: Little tool in python to watch anime from the terminal (the better way to watch anime)
    Home-page: https://github.com/sdaqo/anipy-cli
    Author: sdaqo
    Author-email: [email protected]
    License: GPL-3.0
    Location: /home/michael/.local/lib/python3.10/site-packages
    Requires: better-ffmpeg-progress, bs4, kitsu.py-extended, m3u8, moviepy, pycryptodomex, pypresence, python-dateutil, requests, tqdm
    Required-by:
    

    Platform

    • OS: Bedrock Linux
    • Python version 3.10.4

    Additional context Output (from both trying to download and watch normally):

    ❯ anipy-cli -d
    ***Download Mode***
    Downloads are stored in: /home/michael/anime
    Search Kitsu for anime in Season? (y|n):
    >>
    Search: cowboy bebop
    Add another search: (y|n)
    
    
    Current:  cowboy bebop
    [1] Cowboy Bebop
    [2] Cowboy Bebop (Dub)
    [3] Cowboy Bebop: Tengoku no Tobira
    [4] Cowboy Bebop: Tengoku no Tobira (Dub)
    [5] Cowboy Bebop Knockin` on Heaven`s Door
    Enter Number: 2
    Episode [1-26]: 15
    anipy-cli: error: quality not avalible, using default
    --------------------
    Downloading: Cowboy Bebop (Dub) EP: 15 - hlsp
    Type: m3u8
    Downloader: internal
    Traceback (most recent call last):
      File "/home/michael/.local/bin/anipy-cli", line 8, in <module>
        sys.exit(main())
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/run_anipy_cli.py", line 8, in main
        cli.main()
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/cli.py", line 641, in main
        download_cli(args.quality, args.ffmpeg, args.no_kitsu)
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/cli.py", line 106, in download_cli
        download(show_entry, ffmpeg).download()
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/download.py", line 73, in download
        self.multithread_m3u8_dl()
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/download.py", line 256, in multithread_m3u8_dl
        self._m3u8_content = self._download_m3u8(
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/download.py", line 293, in _download_m3u8
        resp.raise_for_status()
      File "/home/michael/.local/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://www11.gogocdn.stream/videos/hls/fHLZTWB-TVC_A6YXgjehJg/1655596029/106825/72c2d7ea52bff63114544ca2a4b17e6d/ep.15.1648324057.m3u8
    
    ~/.local/lib/python3.10/site-packages/anipy_cli   20s
    ❯ anipy-cli
    Search: cowboy bebop
    [1] Cowboy Bebop
    [2] Cowboy Bebop (Dub)
    [3] Cowboy Bebop: Tengoku no Tobira
    [4] Cowboy Bebop: Tengoku no Tobira (Dub)
    [5] Cowboy Bebop Knockin` on Heaven`s Door
    Enter Number: 2
    Episode [1-26]: 15
    anipy-cli: error: quality not avalible, using default
    Traceback (most recent call last):
      File "/home/michael/.local/bin/anipy-cli", line 8, in <module>
        sys.exit(main())
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/run_anipy_cli.py", line 8, in main
        cli.main()
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/cli.py", line 659, in main
        default_cli(args.quality, player)
      File "/home/michael/.local/lib/python3.10/site-packages/anipy_cli/cli.py", line 43, in default_cli
        sub_proc = start_player(show_entry, rpc_client, player)
    NameError: name 'rpc_client' is not defined
    
    wishlist 
    opened by Dabbing-Guy 1
Owner
sdao
sdao
A little tool that uses LLVM to extract simple "what does this do" level instruction information from all architectures.

moirai: MOre InstRuctions and Information Backcronym. Anyway, this is a small project to extract useful instruction definitions from LLVM's platform d

null 2 Jul 30, 2022
Cool little Python scripts & projects I've made.

Little Python Projects A repository for neat little Python scripts I've made! How to run a script: *NOTE: You'll need to install Python v3 or higher.

dood 1 Jan 19, 2022
little proyect to organize myself, but maybe can help someone else

TaskXT 0.1 Little proyect to organize myself, but maybe can help someone else Idea The main idea is to ogranize you work and stuff to do, but with onl

Gabriel Carmona 4 Oct 3, 2021
The little-endian version of MessagePack

MessagePackEL This is the little-endian version of MessagePack, except the endianness is different, the rest is exactly the same as MessagePack. C lib

dukelec 9 May 13, 2022
Just a little benchmark for scrapper PC's

PopMark Just a little benchmark for scrapper PC's This benchmark is for old computer that dont support other benchmark because of support. Like lack o

Garry 1 Nov 24, 2021
Learning a Little about Containerlab

Learning a Little about Containerlab Hello all. This is the respository based on this blog post. Getting Started Feel free to use this example. You wi

null 10 Oct 16, 2022
A simple script that can watch a list of directories for change and does some action

plot_watcher A simple script that can watch a list of directories and does some action when a specific kind of change happens In its current implement

Charaf Errachidi 12 Sep 10, 2021
Find out where all films you want to watch are streaming

Just Watch Letterboxd Find out where all films you want to watch are streaming Ever wonder what films you want to watch are already on the streaming p

Jordan Oslislo 2 Feb 4, 2022
Archive, organize, and watch for changes to publicly available information.

0. Overview The Trapper Keeper is a collection of scripts that support archiving information from around the web to make it easier to study and use. I

Bill Fitzgerald 9 Oct 26, 2022
A flexible free and unlimited python tool to translate between different languages in a simple way using multiple translators.

deep-translator Translation for humans A flexible FREE and UNLIMITED tool to translate between different languages in a simple way using multiple tran

Nidhal Baccouri 806 Jan 4, 2023
basic tool for NFT. let's spam, this is the easiest way to generate a hell lotta image

NFT generator this is the easiest way to generate a hell lotta image buckle up and follow me! how to first have your image in .png (transparent backgr

null 34 Nov 18, 2022
Daily knowledge pills to get better in Python.

Python daily pills Daily knowledge pills to get better Python code. Why Does your Python code suffers of any of this symptoms? Incorrect Indentation I

Jeferson Vaz dos Santos 35 Sep 19, 2022
Better firefox bookmarks script for rofi

rofi-bookmarks Small python script to open firefox bookmarks with rofi. Features Icons! Only show bookmarks in a specified bookmark folder Show entire

null 32 Nov 10, 2022
This is a fork of the BakeTool with some improvements that I did to have better workflow.

blender-bake-tool This is a fork of the BakeTool with some improvements that I did to have better workflow. 99.99% of work was done by BakeTool team.

Acvarium 3 Oct 4, 2022
Better Giveaways is a bot that will change the experience of using a giveaway bot forever.

Better-Giveaways Better Giveaways is a bot that will change the experience of using a giveaway bot forever. VoxelBotUtils/Novus, latest PyPi releases

Lightning 2 Jan 12, 2022
A tool to flash .ofp files in bootloader mode without needing MSM Tool, an alternative to official realme tool

Oppo/Realme Flash .OFP File on Bootloader A tool to flash .ofp files in bootloader mode without needing MSM Tool, an alternative to official realme to

Italo Almeida 70 Jan 2, 2023
Probably the best way to simulate block scopes in Python

This is a package, as it says on the tin, to emulate block scoping in Python, the lack of which being a clever design choice yet sometimes a trouble.

null 88 Oct 26, 2022
run-js Goal: The Easiest Way to Run JavaScript in Python

run-js Goal: The Easiest Way to Run JavaScript in Python features Stateless Async JS Functions No Intermediary Files Functional Programming CommonJS a

Daniel J. Dufour 9 Aug 16, 2022
Easy way to build a SaaS application using Python and Dash

EasySaaS This project will be attempt to make a great starting point for your next big business as easy and efficent as possible. This project will cr

xianhu 3 Nov 17, 2022