├── .assets ├── ani-cli-scraping-flow.png ├── ani-cli-ux-spec.png ├── dream.png └── matrix-logo.svg ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── ani-cli.yml │ ├── inverse-ani.yml │ ├── inverse-md.yml │ ├── markdown.yml │ ├── title.yml │ └── version.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── ani-cli ├── ani-cli.1 ├── disclaimer.md ├── hacking.md ├── matrix.md └── shell.nix /.assets/ani-cli-scraping-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justchokingaround/ani-cli/998b508724b16b139920a523003befcb08181786/.assets/ani-cli-scraping-flow.png -------------------------------------------------------------------------------- /.assets/ani-cli-ux-spec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justchokingaround/ani-cli/998b508724b16b139920a523003befcb08181786/.assets/ani-cli-ux-spec.png -------------------------------------------------------------------------------- /.assets/dream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justchokingaround/ani-cli/998b508724b16b139920a523003befcb08181786/.assets/dream.png -------------------------------------------------------------------------------- /.assets/matrix-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 10 | 12 | 13 | matrix logo white 15 | Created with Sketch. 17 | 20 | 27 | 28 | 30 | 36 | 40 | 43 | 46 | 49 | 52 | 55 | 58 | 61 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @port19x 2 | README.md @justchokingaround 3 | ani-cli @Derisis13 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Ran into some unexpected behaviour? NOT FOR FEATURE REQUESTS 4 | title: '' 5 | labels: 'priority 2: medium, type: bug' 6 | assignees: '' 7 | 8 | --- 9 | ## **Make sure you are on the latest version by running `ani-cli -U`** 10 | 11 | **Metadata (please complete the following information)** 12 | Version: [e.g. 4.7.6, run `ani-cli -V` to find out] 13 | OS: [e.g. Windows 10 / Linux Mint 20.3] 14 | Shell: [e.g. zsh, run `readlink /bin/sh` to get your shell] 15 | Anime: [e.g. flcl] (if applicable) 16 | 17 | **Describe the bug** 18 | Downloading is broken. 19 | It says something about an unsupported protocol, see screenshot. 20 | 21 | **Steps To Reproduce** 22 | 23 | 1. Run `ani-cli -d flcl` 24 | 2. Choose 2 (fooly-cooly) 25 | 3. Choose episode 1 26 | 27 | **Expected behavior** 28 | Downloading should work 29 | 30 | **Screenshots (if applicable; you can just drag the image onto github. remove the following line if not needed)** 31 | ![image](https://user-images.githubusercontent.com/82055622/151030428-2e78d15f-4ba9-4d86-b6f3-8307557b4b29.png) 32 | 33 | **Additional context** 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Are we missing your favorite feature? 4 | title: '' 5 | labels: 'priority 4: wishlist, type: feature request' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | There is a better player for mac users than mpv. 12 | It's called iina and is a mpv frontend written in swift. 13 | It bugs me that I can't use it yet. 14 | 15 | **Describe the solution you'd like** 16 | Please add iina, maybe through a `-i` flag analogous to the vlc `-v` flag 17 | 18 | **Describe alternatives you've considered** 19 | Maybe support any player string by the user. 20 | But I assume thats drastically more difficult. 21 | 22 | **Additional context** 23 | iina is just an mpv frontend and accepts its flags. 24 | Needless to say it can play urls. 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Pull Request Template 2 | 3 | ## Type of change 4 | 5 | - [ ] Bug fix 6 | - [ ] Feature 7 | - [ ] Documentation update 8 | 9 | ## Description 10 | 11 | *ramble here* 12 | 13 | ## Checklist 14 | 15 | - [ ] any anime playing 16 | - [ ] bumped version 17 | --- 18 | - [ ] next, prev and replay work 19 | - [ ] `-c` history and continue work 20 | - [ ] `-d` downloads work 21 | - [ ] `-s` syncplay works 22 | - [ ] `-q` quality works 23 | - [ ] `-v` vlc works 24 | - [ ] `-e` select episode works 25 | - [ ] `-S` select index works 26 | - [ ] `-r` range selection works 27 | - [ ] `--skip` ani-skip works 28 | - [ ] `--skip-title` ani-skip title argument works 29 | - [ ] `--no-detach` no detach works 30 | - [ ] `--dub` and regular (sub) mode both work 31 | - [ ] all providers return links (not necessarily on a single anime, use debug mode to confirm) 32 | --- 33 | - [ ] `-h` help info is up to date 34 | - [ ] Readme is up to date 35 | - [ ] Man page is up to date 36 | 37 | ## Additional Testcases 38 | 39 | - The safe bet: One Piece 40 | - Episode 0: Saenai Heroine no Sodatekata ♭ 41 | - Unicode: Saenai Heroine no Sodatekata ♭ 42 | - Non-whole episodes: Tensei shitara slime datta ken (ep. 24.5, ep. 24.9) 43 | -------------------------------------------------------------------------------- /.github/workflows/ani-cli.yml: -------------------------------------------------------------------------------- 1 | name: 'ani-cli checks' 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | paths: 8 | - "**ani-cli" 9 | 10 | jobs: 11 | sh-checker: 12 | name: Shellcheck + Shfmt 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Run the sh-checker 17 | uses: luizm/action-sh-checker@master 18 | env: 19 | SHELLCHECK_OPTS: -s sh -o all -e 2250 20 | SHFMT_OPTS: -i 4 -ci -d 21 | 22 | check-exec: 23 | name: Executable Bit 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@v3 27 | - name: test exec bit 28 | run: test -x "./ani-cli" 29 | 30 | check-no-awk: 31 | name: No Awk Allowed 32 | runs-on: ubuntu-latest 33 | steps: 34 | - uses: actions/checkout@v3 35 | - name: verify that noone added awk 36 | run: '! grep awk "./ani-cli"' 37 | -------------------------------------------------------------------------------- /.github/workflows/inverse-ani.yml: -------------------------------------------------------------------------------- 1 | # Added due to required but conditional checks 2 | # Read more: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/troubleshooting-required-status-checks#handling-skipped-but-required-checks 3 | 4 | name: 'ani-cli checks' 5 | on: 6 | pull_request: 7 | paths-ignore: 8 | - "**ani-cli" 9 | jobs: 10 | sh-checker: 11 | name: Shellcheck + Shfmt 12 | runs-on: ubuntu-latest 13 | steps: 14 | - run: 'echo "Not required: did not modify ani-cli"' 15 | check-exec: 16 | name: Executable Bit 17 | runs-on: ubuntu-latest 18 | steps: 19 | - run: 'echo "Not required: did not modify ani-cli"' 20 | version-bump: 21 | name: Version Bump 22 | runs-on: ubuntu-latest 23 | steps: 24 | - run: 'echo "Not required: did not modify ani-cli"' 25 | -------------------------------------------------------------------------------- /.github/workflows/inverse-md.yml: -------------------------------------------------------------------------------- 1 | # Added due to required but conditional checks 2 | # Read more: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/troubleshooting-required-status-checks#handling-skipped-but-required-checks 3 | name: 'markdown checks' 4 | on: 5 | pull_request: 6 | paths-ignore: 7 | - "**.md" 8 | jobs: 9 | dead-links: 10 | name: Dead Link Checker 11 | runs-on: ubuntu-latest 12 | steps: 13 | - run: 'echo "Not required: did not modify documentation"' 14 | trailing-ws: 15 | name: Find Trailing Whitespace 16 | runs-on: ubuntu-latest 17 | steps: 18 | - run: 'echo "Not required: did not modify documentation"' 19 | -------------------------------------------------------------------------------- /.github/workflows/markdown.yml: -------------------------------------------------------------------------------- 1 | name: 'markdown checks' 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | paths: 8 | - "**.md" 9 | 10 | jobs: 11 | dead-links: 12 | name: Dead Link Checker 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Run DeadFinder 16 | uses: hahwul/deadfinder@1.2.4 17 | id: broken-link 18 | with: 19 | command: file 20 | target: "**.md" 21 | trailing-ws: 22 | name: Find Trailing Whitespace 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v3 26 | - uses: ocular-d/trailing-spaces@0.0.2 27 | -------------------------------------------------------------------------------- /.github/workflows/title.yml: -------------------------------------------------------------------------------- 1 | name: "semantic pr title" 2 | on: 3 | pull_request: 4 | types: [opened, edited, ready_for_review, synchronize] 5 | permissions: 6 | pull-requests: read 7 | 8 | jobs: 9 | main: 10 | name: Validate PR Title 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: amannn/action-semantic-pull-request@v5 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/version.yml: -------------------------------------------------------------------------------- 1 | name: 'ani-cli checks' 2 | on: 3 | pull_request: 4 | paths: 5 | - "**ani-cli" 6 | 7 | jobs: 8 | version-bump: 9 | name: Version Bump 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | with: 14 | fetch-depth: 0 15 | - name: check version bump 16 | run: git diff origin/master | grep version_number 17 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | ## Pull Requests 4 | 5 | - Appease the linter 6 | - Bump the version 7 | - Adjust the Readme according to your changes (if applicable) 8 | - No extra dependencies unless absolutely necessary 9 | - If you're fixing an issue, open an issue as well or link existing one 10 | 11 | ## Issues 12 | 13 | - Use the issue templates 14 | - When requesting a feature, check it hasn't been [rejected](https://github.com/pystardust/ani-cli/issues/523) previously 15 | - Provide screenshot if applicable 16 | 17 | ## How else can I help? 18 | 19 | - Join the [discord](https://discord.gg/aqu7GpqVmR) 20 | - Take part in troubleshooting and testing 21 | - Star the repo 22 | - Follow the maintainers 23 | 24 | ## Development with nix 25 | 26 | When you develop with nix you can use the [dev shell](https://github.com/pystardust/ani-cli#nix-shell). 27 | 28 | To run the dev shell you can run the following command in the repository root: 29 | ```shell 30 | nix-shell 31 | ``` 32 | 33 | The dev shell includes the following packages: 34 | - runtime dependencies of ani-cli 35 | - shfmt 36 | - shellcheck 37 | 38 | Its also possible to use alternative packages for the video player or add features with this command: 39 | ```shell 40 | nix-shell --arg true 41 | ``` 42 | These are the packages available in the dev shell: 43 | - `withVlc` 44 | - `withIina` 45 | - `chromecastSupport` 46 | - `syncSupport` 47 | 48 | Just chain these commands together when you wanna multiple features for example: 49 | ```shell 50 | nix-shell --arg withVlc true --arg chromecastSupport true 51 | ``` 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |

12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |

22 | 23 |

24 | A cli to browse and watch anime (alone AND with friends). This tool scrapes the site allanime. 25 |

26 | 27 |

28 | Showcase 29 |

30 | 31 | [ani-cli-demo.webm](https://user-images.githubusercontent.com/44473782/224679247-0856e652-f187-4865-bbcf-5a8e5cf830da.webm) 32 | 33 | ## Table of Contents 34 | 35 | - [Fixing errors](#fixing-errors) 36 | - [Install](#install) 37 | - [Tier 1: Linux, Mac, Android](#tier-1-support-linux-mac-android) 38 | - [Tier 2: Windows, iOS, Steam Deck](#tier-2-support-windows-ios-steam-deck) 39 | - [From Source](#installing-from-source) 40 | - [Uninstall](#uninstall) 41 | - [Dependencies](#dependencies-1) 42 | - [Ani-Skip](#ani-skip) 43 | - [Homies](#homies) 44 | - [Contribution Guidelines](./CONTRIBUTING.md) 45 | - [Disclaimer](./disclaimer.md) 46 | 47 | ## Fixing errors 48 | 49 | If you encounter `No results found` (and are sure the prompt was correct) or any breaking issue, then make sure you are on **latest version** by typing 50 | `sudo ani-cli -U` to update on Linux, Mac and Android. On Windows, run windows terminal preview and there type `ani-cli -U`. 51 | If after this the issue persists then open an issue. 52 | 53 | ## Install 54 | 55 | [![Packaging status](https://repology.org/badge/vertical-allrepos/ani-cli.svg?minversion=4.0)](https://repology.org/project/ani-cli/versions) 56 | 57 | ### Tier 1 Support: Linux, Mac, Android 58 | 59 | *These Platforms have rock solid support and are used by maintainers and large parts of the userbase.* 60 | 61 |
Linux 62 | 63 | #### Native Packages 64 | 65 | *Native packages have a more robust update cycle, but sometimes they are slow to upgrade. \ 66 | If the one for your platform is up-to-date we suggest going with it.* 67 | 68 |
Debian 13/unstable 69 | 70 | ```sh 71 | sudo apt install ani-cli 72 | ``` 73 |
74 | 75 |
Fedora 76 | 77 | To install mpv (and vlc) you need _RPM Fusion free_ enabled. Simply follow the instructions here: https://rpmfusion.org/Configuration 78 | To be able to install syncplay, you'll need to enable this copr repo (instructions included): https://copr.fedorainfracloud.org/coprs/batmanfeynman/syncplay/. 79 | 80 | To install ani-cli: 81 | ```sh 82 | sudo dnf copr enable derisis13/ani-cli 83 | sudo dnf install ani-cli 84 | ``` 85 | *If for your distro uses rpm and you would like to see a native package, open an issue.* 86 | 87 |
Arch 88 | 89 | Build and install from the AUR: 90 | ```sh 91 | yay -S ani-cli 92 | ``` 93 | Also consider `ani-cli-git` 94 | 95 |
Gentoo 96 | 97 | Build and install from the GURU: 98 | ```sh 99 | sudo eselect repository enable guru 100 | sudo emaint sync -r guru 101 | sudo emerge -a ani-cli 102 | ``` 103 | Consider using the 9999 ebuild. 104 | ```sh 105 | sudo emerge -a =app-misc/ani-cli-9999 106 | ``` 107 | 108 |
OpenSuse 109 | 110 | On Suse the provided MPV and VLC packages are missing features that are used by ani-cli. The only required is the "Only Essentials" repository which has versions for each Suse release. 111 | You can find instructions on this [here](https://en.opensuse.org/Additional_package_repositories#Packman). 112 | 113 | To add the ani-cli copr repo, update then install ani-cli run (on both versions): 114 | ```sh 115 | zypper addrepo https://download.copr.fedorainfracloud.org/results/derisis13/ani-cli/opensuse-tumbleweed-x86_64/ ani-cli 116 | zypper dup 117 | zypper install ani-cli 118 | ``` 119 | You'll get a warning about `Signature verification failed [4-Signatures public key is not available]` but this can be ignored from the prompt. 120 | 121 | *Note: package is noarch, so any architecture should work, even though the repo is labelled x86-64* 122 | 123 |
MacOS 124 | 125 | Install dependencies [(See below)](#dependencies-1) 126 | 127 | Install [HomeBrew](https://docs.brew.sh/Installation) if not installed. 128 | 129 | ```sh 130 | git clone "https://github.com/pystardust/ani-cli.git" && cd ./ani-cli 131 | cp ./ani-cli "$(brew --prefix)"/bin 132 | cd .. && rm -rf ./ani-cli 133 | ``` 134 | 135 | *To install (with Homebrew) the dependencies required on Mac OS, you can run:* 136 | 137 | ```sh 138 | brew install curl grep aria2 ffmpeg git fzf yt-dlp && \ 139 | brew install --cask iina 140 | ``` 141 | *Why iina and not mpv? Drop-in replacement for mpv for MacOS. Integrates well with OSX UI. Excellent support for M1. Open Source.* 142 | 143 |
Android 144 | 145 | Install termux [(Guide)](https://termux.com/) 146 | 147 | #### Termux package 148 | 149 | ```sh 150 | pkg up -y 151 | pkg install ani-cli 152 | ``` 153 | If you're using Android 14 make sure to run this due to [#1206](https://github.com/pystardust/ani-cli/issues/1206): 154 | ```sh 155 | pkg install termux-am 156 | ``` 157 | 158 | For players you can use the apk (playstore/fdroid) versions of mpv and vlc. Note that these cannot be checked from termux so a warning is generated when checking dependencies. 159 | 160 |
161 | 162 | ### Tier 2 Support: Windows, iOS, Steam Deck 163 | 164 | *While officially supported, installation is more involved on these platforms and sometimes issues arise. \ 165 | Reach out if you need help.* 166 | 167 |
Windows 168 | 169 | First, you'll need windows terminal preview. [(Install)](https://apps.microsoft.com/store/detail/windows-terminal-preview/9N8G5RFZ9XK3?hl=en-us&gl=US) It comes preinstalled with Windows 11 170 | 171 | Then, install scoop. You will use this to install and update ani-cli from time to time. [(Install)](https://scoop.sh/) Follow **quickstart**. 172 | 173 | ```sh 174 | scoop bucket add extras 175 | scoop install ani-cli fzf mpv git 176 | ``` 177 | Consider also installing `yt-dlp` and `aria2` for downloading to work 178 | 179 | #### Dependencies 180 | 181 | All dependencies can be installed with scoop (from the extras bucket), however some users experienced that installed programs aren't always added to the path. If this happens installing from winget instead usually works. 182 | 183 | Note that curl can cause issues. 184 | ani-cli has been tested unsuccessfully with curl `7.83.1` and successfully with `7.86.0`. 185 | If you run into issues, try the scoop install or grab the newest curl you can find. 186 | 187 |
iOS 188 | 189 | Install iSH and VLC from the app store. 190 | 191 | Make sure apk is updated using 192 | ```apk update; apk upgrade``` 193 | then run this: 194 | ```sh 195 | apk add grep sed curl fzf git aria2 ncurses 196 | apk add ffmpeg 197 | git clone https://github.com/pystardust/ani-cli ~/.ani-cli 198 | cp ~/.ani-cli/ani-cli /usr/local/bin/ani-cli 199 | chmod +x /usr/local/bin/ani-cli 200 | rm -rf ~/.ani-cli 201 | ``` 202 | note that downloading is going to be very slow. This is an iSH issue, not an ani-cli issue. 203 |
204 | 205 |
Steam Deck 206 | 207 | #### Copypaste script: 208 | 209 | * Switch to Desktop mode (`STEAM` Button > Power > Switch to Desktop) 210 | * Open `Konsole` (Steam Deck Icon in bottom left corner > System > Konsole) 211 | * Copy the script, paste it in the CLI and press Enter("A" button on Steam Deck) 212 | 213 | ```sh 214 | [ ! -d ~/.local/bin ] && mkdir ~/.local/bin && echo "export PATH=$HOME/.local/bin:\$PATH" >> ".$(echo $SHELL | sed -nE "s|.*/(.*)\$|\1|p")rc" 215 | 216 | git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf 217 | ~/.fzf/install 218 | 219 | mkdir ~/.aria2c 220 | curl -o ~/.aria2c/aria2-1.36.0.tar.bz2 https://github.com/q3aql/aria2-static-builds/releases/download/v1.36.0/aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2 221 | tar xvf ~/.aria2c/aria2-1.36.0.tar.bz2 -C ~/.aria2c/ 222 | cp ~/.aria2c/aria2-1.36.0-linux-gnu-64bit-build1/aria2c ~/.local/bin/ 223 | chmod +x ~/.local/bin/aria2c 224 | 225 | curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp 226 | chmod +x ~/.local/bin/yt-dlp 227 | 228 | mkdir ~/.patch 229 | curl -o ~/.patch/patch.tar.zst https://mirror.sunred.org/archlinux/core/os/x86_64/patch-2.7.6-10-x86_64.pkg.tar.zst 230 | tar xvf ~/.patch/patch.tar.zst -C ~/.patch/ 231 | cp ~/.patch/usr/bin/patch ~/.local/bin/ 232 | 233 | git clone https://github.com/pystardust/ani-cli.git ~/.ani-cli 234 | cp ~/.ani-cli/ani-cli ~/.local/bin/ 235 | 236 | flatpak install io.mpv.Mpv 237 | ``` 238 | press enter("A" button on Steam Deck) on questions 239 | 240 | #### Installation in steps: 241 | 242 | ##### Install mpv (Flatpak version): 243 | 244 | ```sh 245 | flatpak install io.mpv.Mpv 246 | ``` 247 | press enter("A" button on Steam Deck) on questions 248 | 249 | ##### Install [fzf](https://github.com/junegunn/fzf): 250 | 251 | ```sh 252 | git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf 253 | ~/.fzf/install 254 | ``` 255 | press enter("A" button on Steam Deck) on questions 256 | 257 | ##### Make a ~/.local/bin folder if doesn't exist and add it to $PATH 258 | 259 | ```sh 260 | [ ! -d ~/.local/bin ] && mkdir ~/.local/bin && echo "export PATH=$HOME/.local/bin:\$PATH" >> ".$(echo $SHELL | sed -nE "s|.*/(.*)\$|\1|p")rc" 261 | ``` 262 | 263 | ##### Install [aria2](https://github.com/aria2/aria2) (needed for download feature only): 264 | 265 | ```sh 266 | mkdir ~/.aria2c 267 | curl -o ~/.aria2c/aria2-1.36.0.tar.bz2 https://github.com/q3aql/aria2-static-builds/releases/download/v1.36.0/aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2 268 | tar xvf ~/.aria2c/aria2-1.36.0.tar.bz2 -C ~/.aria2c/ 269 | cp ~/.aria2c/aria2-1.36.0-linux-gnu-64bit-build1/aria2c ~/.local/bin/ 270 | chmod +x ~/.local/bin/aria2c 271 | ``` 272 | 273 | ##### Install [yt-dlp](https://github.com/yt-dlp/yt-dlp) (needed for download feature only): 274 | 275 | ```sh 276 | curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp 277 | chmod +x ~/.local/bin/yt-dlp 278 | ``` 279 | 280 | ##### Install [patch](https://savannah.gnu.org/projects/patch/) (needed for self-update feature [ -U ] ): 281 | 282 | ```sh 283 | mkdir ~/.patch 284 | curl -o ~/.patch/patch.tar.zst https://mirror.sunred.org/archlinux/core/os/x86_64/patch-2.7.6-10-x86_64.pkg.tar.zst 285 | tar xvf ~/.patch/patch.tar.zst -C ~/.patch/ 286 | cp ~/.patch/usr/bin/patch ~/.local/bin/ 287 | ``` 288 | 289 | ##### Install ani-cli: 290 | 291 | ```sh 292 | git clone https://github.com/pystardust/ani-cli.git ~/.ani-cli 293 | cp ~/.ani-cli/ani-cli ~/.local/bin/ 294 | ``` 295 | 296 | ##### Optional: add desktop entry: 297 | 298 | ``` 299 | echo '[Desktop Entry] 300 | Encoding=UTF-8 301 | Type=Application 302 | Exec=bash -c "source $HOME/.'$(echo $SHELL | sed -nE "s|.*/(.*)\$|\1|p")'rc && konsole --fullscreen -e ani-cli" 303 | Name=ani-cli' > $HOME/.local/share/applications/ani-cli.desktop 304 | ``` 305 | The .desktop entry will allow to start ani-cli in Konsole directly from "Gaming Mode" 306 | In Steam Desktop app: 307 | `Add game` > `Add a non-steam game` > tick a box for `ani-cli` > `Add selected programs` 308 |
309 | 310 | ### Installing from source 311 | 312 | *This method works for any unix-like operating system and is a baseline for porting efforts.* 313 | 314 | Install dependencies [(See below)](#dependencies-1) 315 | 316 | ```sh 317 | git clone "https://github.com/pystardust/ani-cli.git" 318 | sudo cp ani-cli/ani-cli /usr/local/bin 319 | rm -rf ani-cli 320 | ``` 321 | 322 | ## Uninstall 323 | 324 |
325 | 326 | * apt: 327 | ```sh 328 | sudo apt remove ani-cli 329 | # to remove the repository from apt 330 | sudo rm -f /etc/apt/trusted.gpg.d/ani-cli.asc /etc/apt/sources.list.d/ani-cli-debian.list 331 | ``` 332 | * dnf: 333 | ```sh 334 | sudo dnf remove ani-cli # for ani-cli 335 | # disable the repo in dnf 336 | dnf copr disable derisis13/ani-cli 337 | ``` 338 | You might want to uninstall RPM fusion if you don't use it otherwise 339 | * zypper: 340 | ```sh 341 | zypper remove ani-cli 342 | zypper removerepo ani-cli 343 | ``` 344 | You might want to remove `packman-essentials` if you don't need it otherwise 345 | * AUR: 346 | ```sh 347 | yay -R ani-cli 348 | ``` 349 | * Scoop: 350 | ```sh 351 | scoop uninstall ani-cli 352 | ``` 353 | * Linux: 354 | ```sh 355 | sudo rm "/usr/local/bin/ani-cli" 356 | ``` 357 | * Mac: 358 | ```sh 359 | rm "$(brew --prefix)/bin/ani-cli" 360 | ``` 361 | * Windows: 362 | In **Git Bash** run (as administrator): 363 | ```sh 364 | rm "/usr/bin/ani-cli" 365 | ``` 366 | * Termux package 367 | ```sh 368 | pkg remove ani-cli 369 | ``` 370 | * Android: 371 | ```sh 372 | rm "$PREFIX/bin/ani-cli" 373 | ``` 374 | * Steam Deck 375 | ```sh 376 | rm "~/.local/bin/ani-cli" 377 | rm -rf ~/.ani-cli 378 | ``` 379 | optionally: remove dependencies: 380 | ```sh 381 | rm ~/.local/bin/aria2c 382 | rm ~/.local/bin/yt-dlp 383 | rm -rf "~/.aria2" 384 | rm -rf "~/.fzf" 385 | flatpak uninstall io.mpv.Mpv 386 | ``` 387 | * iOS 388 | ``` 389 | rm -rf /usr/local/bin/ani-cli 390 | ``` 391 | To uninstall other dependencies: 392 | ``` 393 | apk del grep sed curl fzf git aria2 ffmpeg ncurses 394 | ``` 395 | 396 |
397 | 398 | ## Dependencies 399 | 400 | - grep 401 | - sed 402 | - curl 403 | - mpv - Video Player 404 | - iina - mpv replacement for MacOS 405 | - aria2c - Download manager 406 | - yt-dlp - m3u8 Downloader 407 | - ffmpeg - m3u8 Downloader (fallback) 408 | - fzf - User interface 409 | - ani-skip (optional) 410 | - patch - Self updating 411 | 412 | ### Ani-Skip 413 | 414 | Ani-skip is a script to automatically skip anime opening sequences, making it easier to watch your favorite shows without having to manually skip the intros each time (from the original [README](https://github.com/synacktraa/ani-skip/tree/master#a-script-to-automatically-skip-anime-opening-sequences-making-it-easier-to-watch-your-favorite-shows-without-having-to-manually-skip-the-intros-each-time)). 415 | 416 | For install instructions visit [ani-skip](https://github.com/synacktraa/ani-skip). 417 | 418 | Ani-skip uses the external lua script function of mpv and as such – for now – only works with mpv. 419 | 420 | **Warning:** For now, ani-skip does **not** seem to work under Windows. 421 | 422 | **Note:** It may be, that ani-skip won't know the anime you're trying to watch. Try using the `--skip-title ` command line argument. (It uses the [aniskip API](https://github.com/lexesjan/typescript-aniskip-extension/tree/main/src/api/aniskip-http-client) and you can contribute missing anime or ask for including it in the database on their [discord server](https://discord.com/invite/UqT55CbrbE)). 423 | 424 | ## Homies 425 | 426 | * [animdl](https://github.com/justfoolingaround/animdl): Ridiculously efficient, fast and light-weight (supports most sources: allanime, zoro ... (Python) 427 | * [jerry](https://github.com/justchokingaround/jerry): stream anime with anilist tracking and syncing, with discord presence (Shell) 428 | * [anipy-cli](https://github.com/sdaqo/anipy-cli): ani-cli rewritten in python (Python) 429 | * [Dantotsu](https://github.com/rebelonion/Dantotsu): Rebirth of Saikou, Best android app for anime/manga/LN with anilist integration (Kotlin) 430 | * [mangal](https://github.com/metafates/mangal): Download & read manga from any source with anilist sync (Go) 431 | * [lobster](https://github.com/justchokingaround/lobster): Watch movies and series from the terminal (Shell) 432 | * [mov-cli](https://github.com/mov-cli/mov-cli): Watch everything from your terminal. (Python) 433 | * [dra-cla](https://github.com/CoolnsX/dra-cla): ani-cli equivalent for korean dramas (Shell) 434 | * [redqu](https://github.com/port19x/redqu): A media centric reddit client (Clojure) 435 | * [doccli](https://github.com/TowarzyszFatCat/doccli): A cli to watch anime with POLISH subtitles (Python) 436 | * [GoAnime](https://github.com/alvarorichard/GoAnime): A CLI tool to browse, play, and download anime in Portuguese(Go) 437 | -------------------------------------------------------------------------------- /ani-cli: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | version_number="4.8.5" 4 | 5 | # UI 6 | 7 | external_menu() { 8 | rofi "$1" -sort -dmenu -i -width 1500 -p "$2" 9 | } 10 | 11 | launcher() { 12 | [ "$use_external_menu" = "0" ] && [ -z "$1" ] && set -- "+m" "$2" 13 | [ "$use_external_menu" = "0" ] && fzf "$1" --reverse --cycle --prompt "$2" 14 | [ "$use_external_menu" = "1" ] && external_menu "$1" "$2" 15 | } 16 | 17 | nth() { 18 | stdin=$(cat -) 19 | [ -z "$stdin" ] && return 1 20 | line_count="$(printf "%s\n" "$stdin" | wc -l | tr -d "[:space:]")" 21 | [ "$line_count" -eq 1 ] && printf "%s" "$stdin" | cut -f2,3 && return 0 22 | prompt="$1" 23 | multi_flag="" 24 | [ $# -ne 1 ] && shift && multi_flag="$1" 25 | line=$(printf "%s" "$stdin" | cut -f1,3 | tr '\t' ' ' | launcher "$multi_flag" "$prompt" | cut -d " " -f 1) 26 | [ -n "$line" ] && printf "%s" "$stdin" | grep -E '^'"${line}"'($|[[:space:]])' | cut -f2,3 || exit 1 27 | } 28 | 29 | die() { 30 | printf "\33[2K\r\033[1;31m%s\033[0m\n" "$*" >&2 31 | exit 1 32 | } 33 | 34 | help_info() { 35 | printf " 36 | Usage: 37 | %s [options] [query] 38 | %s [query] [options] 39 | %s [options] [query] [options] 40 | 41 | Options: 42 | -c, --continue 43 | Continue watching from history 44 | -d, --download 45 | Download the video instead of playing it 46 | -D, --delete 47 | Delete history 48 | -s, --syncplay 49 | Use Syncplay to watch with friends 50 | -S, --select-nth 51 | Select nth entry 52 | -q, --quality 53 | Specify the video quality 54 | -v, --vlc 55 | Use VLC to play the video 56 | -V, --version 57 | Show the version of the script 58 | -h, --help 59 | Show this help message and exit 60 | -e, --episode, -r, --range 61 | Specify the number of episodes to watch 62 | --dub 63 | Play dubbed version 64 | --rofi 65 | Use rofi instead of fzf for the interactive menu 66 | --skip 67 | Use ani-skip to skip the intro of the episode (mpv only) 68 | --no-detach 69 | Don't detach the player (useful for in-terminal playback, mpv only) 70 | --skip-title <title> 71 | Use given title as ani-skip query 72 | -N, --nextep-countdown 73 | Display a countdown to the next episode 74 | -U, --update 75 | Update the script 76 | Some example usages: 77 | %s -q 720p banana fish 78 | %s --skip --skip-title \"one piece\" -S 2 one piece 79 | %s -d -e 2 cyberpunk edgerunners 80 | %s --vlc cyberpunk edgerunners -q 1080p -e 4 81 | %s blue lock -e 5-6 82 | %s -e \"5 6\" blue lock 83 | \n" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" 84 | exit 0 85 | } 86 | 87 | version_info() { 88 | printf "%s\n" "$version_number" 89 | exit 0 90 | } 91 | 92 | update_script() { 93 | update="$(curl -s -A "$agent" "https://raw.githubusercontent.com/pystardust/ani-cli/master/ani-cli")" || die "Connection error" 94 | update="$(printf '%s\n' "$update" | diff -u "$0" -)" 95 | if [ -z "$update" ]; then 96 | printf "Script is up to date :)\n" 97 | else 98 | if printf '%s\n' "$update" | patch "$0" -; then 99 | printf "Script has been updated\n" 100 | else 101 | die "Can't update for some reason!" 102 | fi 103 | fi 104 | exit 0 105 | } 106 | 107 | # checks if dependencies are present 108 | dep_ch() { 109 | for dep; do 110 | command -v "$dep" >/dev/null || die "Program \"$dep\" not found. Please install it." 111 | done 112 | } 113 | 114 | # SCRAPING 115 | 116 | # extract the video links from response of embed urls, extract mp4 links form m3u8 lists 117 | get_links() { 118 | episode_link="$(curl -e "$allanime_refr" -s "https://${allanime_base}$*" -A "$agent" | sed 's|},{|\ 119 | |g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\2 >\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p')" 120 | 121 | case "$episode_link" in 122 | *repackager.wixmp.com*) 123 | extract_link=$(printf "%s" "$episode_link" | cut -d'>' -f2 | sed 's|repackager.wixmp.com/||g;s|\.urlset.*||g') 124 | for j in $(printf "%s" "$episode_link" | sed -nE 's|.*/,([^/]*),/mp4.*|\1|p' | sed 's|,|\ 125 | |g'); do 126 | printf "%s >%s\n" "$j" "$extract_link" | sed "s|,[^/]*|${j}|g" 127 | done | sort -nr 128 | ;; 129 | *vipanicdn* | *anifastcdn*) 130 | if printf "%s" "$episode_link" | head -1 | grep -q "original.m3u"; then 131 | printf "%s" "$episode_link" 132 | else 133 | extract_link=$(printf "%s" "$episode_link" | head -1 | cut -d'>' -f2) 134 | relative_link=$(printf "%s" "$extract_link" | sed 's|[^/]*$||') 135 | curl -e "$allanime_refr" -s "$extract_link" -A "$agent" | sed 's|^#.*x||g; s|,.*|p|g; /^#/d; $!N; s|\ 136 | | >|' | sed "s|>|>${relative_link}|g" | sort -nr 137 | fi 138 | ;; 139 | *) [ -n "$episode_link" ] && printf "%s\n" "$episode_link" ;; 140 | esac 141 | [ -z "$ANI_CLI_NON_INTERACTIVE" ] && printf "\033[1;32m%s\033[0m Links Fetched\n" "$provider_name" 1>&2 142 | } 143 | 144 | # innitialises provider_name and provider_id. First argument is the provider name, 2nd is the regex that matches that provider's link 145 | provider_init() { 146 | provider_name=$1 147 | provider_id=$(printf "%s" "$resp" | sed -n "$2" | head -1 | cut -d':' -f2 | sed 's/../&\ 148 | /g' | sed 's/^01$/9/g;s/^08$/0/g;s/^05$/=/g;s/^0a$/2/g;s/^0b$/3/g;s/^0c$/4/g;s/^07$/?/g;s/^00$/8/g;s/^5c$/d/g;s/^0f$/7/g;s/^5e$/f/g;s/^17$/\//g;s/^54$/l/g;s/^09$/1/g;s/^48$/p/g;s/^4f$/w/g;s/^0e$/6/g;s/^5b$/c/g;s/^5d$/e/g;s/^0d$/5/g;s/^53$/k/g;s/^1e$/\&/g;s/^5a$/b/g;s/^59$/a/g;s/^4a$/r/g;s/^4c$/t/g;s/^4e$/v/g;s/^57$/o/g;s/^51$/i/g;' | tr -d '\n' | sed "s/\/clock/\/clock\.json/") 149 | } 150 | 151 | # generates links based on given provider 152 | generate_link() { 153 | case $1 in 154 | 1) provider_init "wixmp" "/Default :/p" ;; # wixmp(default)(m3u8)(multi) -> (mp4)(multi) 155 | 2) provider_init "dropbox" "/Sak :/p" ;; # dropbox(mp4)(single) 156 | 3) provider_init "wetransfer" "/Kir :/p" ;; # wetransfer(mp4)(single) 157 | 4) provider_init "sharepoint" "/S-mp4 :/p" ;; # sharepoint(mp4)(single) 158 | *) provider_init "gogoanime" "/Luf-mp4 :/p" ;; # gogoanime(m3u8)(multi) 159 | esac 160 | [ -n "$provider_id" ] && get_links "$provider_id" 161 | } 162 | 163 | select_quality() { 164 | case "$1" in 165 | best) result=$(printf "%s" "$links" | head -n1) ;; 166 | worst) result=$(printf "%s" "$links" | grep -E '^[0-9]{3,4}' | tail -n1) ;; 167 | *) result=$(printf "%s" "$links" | grep -m 1 "$1") ;; 168 | esac 169 | [ -z "$result" ] && printf "Specified quality not found, defaulting to best\n" 1>&2 && result=$(printf "%s" "$links" | head -n1) 170 | printf "%s" "$result" | cut -d'>' -f2 171 | } 172 | 173 | # gets embed urls, collects direct links into provider files, selects one with desired quality into $episode 174 | get_episode_url() { 175 | # get the embed urls of the selected episode 176 | episode_embed_gql="query (\$showId: String!, \$translationType: VaildTranslationTypeEnumType!, \$episodeString: String!) { episode( showId: \$showId translationType: \$translationType episodeString: \$episodeString ) { episodeString sourceUrls }}" 177 | 178 | resp=$(curl -e "$allanime_refr" -s -G "${allanime_api}/api" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"$mode\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A "$agent" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"--([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p') 179 | # generate links into sequential files 180 | cache_dir="$(mktemp -d)" 181 | providers="1 2 3 4 5" 182 | for provider in $providers; do 183 | generate_link "$provider" >"$cache_dir"/"$provider" & 184 | done 185 | wait 186 | # select the link with matching quality 187 | links=$(cat "$cache_dir"/* | sed 's|^Mp4-||g;/http/!d' | sort -g -r -s) 188 | rm -r "$cache_dir" 189 | episode=$(select_quality "$quality") 190 | [ -z "$episode" ] && die "Episode not released!" 191 | } 192 | 193 | # search the query and give results 194 | search_anime() { 195 | search_gql="query( \$search: SearchInput \$limit: Int \$page: Int \$translationType: VaildTranslationTypeEnumType \$countryOrigin: VaildCountryOriginEnumType ) { shows( search: \$search limit: \$limit page: \$page translationType: \$translationType countryOrigin: \$countryOrigin ) { edges { _id name availableEpisodes __typename } }}" 196 | 197 | curl -e "$allanime_refr" -s -G "${allanime_api}/api" --data-urlencode "variables={\"search\":{\"allowAdult\":false,\"allowUnknown\":false,\"query\":\"$1\"},\"limit\":40,\"page\":1,\"translationType\":\"$mode\",\"countryOrigin\":\"ALL\"}" --data-urlencode "query=$search_gql" -A "$agent" | sed 's|Show|\ 198 | |g' | sed -nE "s|.*_id\":\"([^\"]*)\",\"name\":\"([^\"]*)\".*${mode}\":([1-9][^,]*).*|\1 \2 (\3 episodes)|p" 199 | } 200 | 201 | time_until_next_ep() { 202 | animeschedule="https://animeschedule.net" 203 | curl -s -G "$animeschedule/api/v3/anime" --data-urlencode "q=$1" | sed 's|"id"|\n|g' | sed -nE 's|.*,"route":"([^"]*)","premier.*|\1|p' | while read -r anime; do 204 | data=$(curl -s "$animeschedule/anime/$anime" | sed '1,/"anime-header-list-buttons-wrapper"/d' | sed -nE 's|.*countdown-time-raw" datetime="([^"]*)">.*|Next Raw Release: \1|p;s|.*countdown-time" datetime="([^"]*)">.*|Next Sub Release: \1|p;s|.*english-title">([^<]*)<.*|English Title: \1|p;s|.*main-title".*>([^<]*)<.*|Japanese Title: \1|p') 205 | status="Ongoing" 206 | color="33" 207 | printf "%s\n" "$data" 208 | ! (printf "%s\n" "$data" | grep -q "Next Raw Release:") && status="Finished" && color="32" 209 | printf "Status: \033[1;%sm%s\033[0m\n---\n" "$color" "$status" 210 | done 211 | exit 0 212 | } 213 | 214 | # get the episodes list of the selected anime 215 | episodes_list() { 216 | episodes_list_gql="query (\$showId: String!) { show( _id: \$showId ) { _id availableEpisodesDetail }}" 217 | 218 | curl -e "$allanime_refr" -s -G "${allanime_api}/api" --data-urlencode "variables={\"showId\":\"$*\"}" --data-urlencode "query=$episodes_list_gql" -A "$agent" | sed -nE "s|.*$mode\":\[([0-9.\",]*)\].*|\1|p" | sed 's|,|\ 219 | |g; s|"||g' | sort -n -k 1 220 | } 221 | 222 | # PLAYING 223 | 224 | process_hist_entry() { 225 | ep_list=$(episodes_list "$id") 226 | ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null 227 | [ -n "$ep_no" ] && printf "%s\t%s - episode %s\n" "$id" "$title" "$ep_no" 228 | } 229 | 230 | update_history() { 231 | if grep -q -- "$id" "$histfile"; then 232 | sed -E "s/^[^\t]+\t${id}\t/${ep_no}\t${id}\t/" "$histfile" >"${histfile}.new" 233 | else 234 | cp "$histfile" "${histfile}.new" 235 | printf "%s\t%s\t%s\n" "$ep_no" "$id" "$title" >>"${histfile}.new" 236 | fi 237 | mv "${histfile}.new" "$histfile" 238 | } 239 | 240 | download() { 241 | case $1 in 242 | *m3u8*) 243 | if command -v "yt-dlp" >/dev/null; then 244 | yt-dlp "$1" --no-skip-unavailable-fragments --fragment-retries infinite -N 16 -o "$download_dir/$2.mp4" 245 | else 246 | ffmpeg -loglevel error -stats -i "$1" -c copy "$download_dir/$2.mp4" 247 | fi 248 | ;; 249 | *) 250 | aria2c --enable-rpc=false --check-certificate=false --continue --summary-interval=0 -x 16 -s 16 "$1" --dir="$download_dir" -o "$2.mp4" --download-result=hide 251 | ;; 252 | esac 253 | } 254 | 255 | play_episode() { 256 | [ "$skip_intro" = 1 ] && skip_flag="$(ani-skip -q "$mal_id" -e "$ep_no")" 257 | [ -z "$episode" ] && get_episode_url 258 | # shellcheck disable=SC2086 259 | case "$player_function" in 260 | debug) 261 | [ -z "$ANI_CLI_NON_INTERACTIVE" ] && printf "All links:\n%s\nSelected link:\n" "$links" 262 | printf "%s\n" "$episode" 263 | ;; 264 | mpv*) 265 | if [ "$no_detach" = 0 ]; then 266 | nohup "$player_function" $skip_flag --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & 267 | else 268 | "$player_function" $skip_flag --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" 269 | fi 270 | ;; 271 | android_mpv) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n is.xyz.mpv/.MPVActivity >/dev/null 2>&1 & ;; 272 | android_vlc) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "${allanime_title}Episode ${ep_no}" >/dev/null 2>&1 & ;; 273 | iina) nohup "$player_function" --no-stdin --keep-running --mpv-force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;; 274 | flatpak_mpv) flatpak run io.mpv.Mpv --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;; 275 | vlc*) nohup "$player_function" --play-and-exit --meta-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;; 276 | *yncpla*) nohup "$player_function" "$episode" -- --force-media-title="${allanime_title}Episode ${ep_no}" >/dev/null 2>&1 & ;; 277 | download) "$player_function" "$episode" "${allanime_title}Episode ${ep_no}" ;; 278 | catt) nohup catt cast "$episode" >/dev/null 2>&1 & ;; 279 | iSH) 280 | printf "\e]8;;vlc://%s\a~~~~~~~~~~~~~~~~~~~~\n~ Tap to open VLC ~\n~~~~~~~~~~~~~~~~~~~~\e]8;;\a\n" "$episode" 281 | sleep 5 282 | ;; 283 | *) nohup "$player_function" "$episode" >/dev/null 2>&1 & ;; 284 | esac 285 | replay="$episode" 286 | unset episode 287 | update_history 288 | [ "$use_external_menu" = "1" ] && wait 289 | } 290 | 291 | play() { 292 | start=$(printf "%s" "$ep_no" | grep -Eo '^(-1|[0-9]+(\.[0-9]+)?)') 293 | end=$(printf "%s" "$ep_no" | grep -Eo '(-1|[0-9]+(\.[0-9]+)?)$') 294 | [ "$start" = "-1" ] && ep_no=$(printf "%s" "$ep_list" | tail -n1) && unset start 295 | [ -z "$end" ] || [ "$end" = "$start" ] && unset start end 296 | [ "$end" = "-1" ] && end=$(printf "%s" "$ep_list" | tail -n1) 297 | line_count=$(printf "%s\n" "$ep_no" | wc -l | tr -d "[:space:]") 298 | if [ "$line_count" != 1 ] || [ -n "$start" ]; then 299 | [ -z "$start" ] && start=$(printf "%s\n" "$ep_no" | head -n1) 300 | [ -z "$end" ] && end=$(printf "%s\n" "$ep_no" | tail -n1) 301 | range=$(printf "%s\n" "$ep_list" | sed -nE "/^${start}\$/,/^${end}\$/p") 302 | [ -z "$range" ] && die "Invalid range!" 303 | for i in $range; do 304 | tput clear 305 | ep_no=$i 306 | printf "\33[2K\r\033[1;34mPlaying episode %s...\033[0m\n" "$ep_no" 307 | play_episode 308 | done 309 | else 310 | play_episode 311 | fi 312 | # moves upto stored positon and deletes to end 313 | [ "$player_function" != "debug" ] && [ "$player_function" != "download" ] && tput rc && tput ed 314 | } 315 | 316 | # MAIN 317 | 318 | # setup 319 | agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/121.0" 320 | allanime_refr="https://allanime.to" 321 | allanime_base="allanime.day" 322 | allanime_api="https://api.${allanime_base}" 323 | mode="${ANI_CLI_MODE:-sub}" 324 | download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}" 325 | quality="${ANI_CLI_QUALITY:-best}" 326 | case "$(uname -a)" in 327 | *Darwin*) player_function="${ANI_CLI_PLAYER:-iina}" ;; # mac OS 328 | *ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux) 329 | *steamdeck*) player_function="${ANI_CLI_PLAYER:-flatpak_mpv}" ;; # steamdeck OS 330 | *MINGW* | *WSL2*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS 331 | *ish*) player_function="${ANI_CLI_PLAYER:-iSH}" ;; # iOS (iSH) 332 | *) player_function="${ANI_CLI_PLAYER:-mpv}" ;; # Linux OS 333 | esac 334 | 335 | no_detach="${ANI_CLI_NO_DETACH:-0}" 336 | use_external_menu="${ANI_CLI_EXTERNAL_MENU:-0}" 337 | skip_intro="${ANI_CLI_SKIP_INTRO:-0}" 338 | # shellcheck disable=SC2154 339 | skip_title="$ANI_CLI_SKIP_TITLE" 340 | [ -t 0 ] || use_external_menu=1 341 | hist_dir="${ANI_CLI_HIST_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/ani-cli}" 342 | [ ! -d "$hist_dir" ] && mkdir -p "$hist_dir" 343 | histfile="$hist_dir/ani-hsts" 344 | [ ! -f "$histfile" ] && : >"$histfile" 345 | search="${ANI_CLI_DEFAULT_SOURCE:-scrape}" 346 | 347 | while [ $# -gt 0 ]; do 348 | case "$1" in 349 | -v | --vlc) 350 | case "$(uname -a)" in 351 | *ndroid*) player_function="android_vlc" ;; 352 | MINGW* | *WSL2*) player_function="vlc.exe" ;; 353 | *ish*) player_function="iSH" ;; 354 | *) player_function="vlc" ;; 355 | esac 356 | ;; 357 | -s | --syncplay) 358 | case "$(uname -s)" in 359 | Darwin*) player_function="/Applications/Syncplay.app/Contents/MacOS/syncplay" ;; 360 | MINGW* | *Msys) 361 | export PATH="$PATH":"/c/Program Files (x86)/Syncplay/" 362 | player_function="syncplay.exe" 363 | ;; 364 | *) player_function="syncplay" ;; 365 | esac 366 | ;; 367 | -q | --quality) 368 | [ $# -lt 2 ] && die "missing argument!" 369 | quality="$2" 370 | shift 371 | ;; 372 | -S | --select-nth) 373 | [ $# -lt 2 ] && die "missing argument!" 374 | index="$2" 375 | shift 376 | ;; 377 | -c | --continue) search=history ;; 378 | -d | --download) player_function=download ;; 379 | -D | --delete) 380 | : >"$histfile" 381 | exit 0 382 | ;; 383 | -V | --version) version_info ;; 384 | -h | --help) help_info ;; 385 | -e | --episode | -r | --range) 386 | [ $# -lt 2 ] && die "missing argument!" 387 | ep_no="$2" 388 | [ -n "$index" ] && ANI_CLI_NON_INTERACTIVE=1 #Checks for -S presence 389 | shift 390 | ;; 391 | --dub) mode="dub" ;; 392 | --no-detach) no_detach=1 ;; 393 | --rofi) use_external_menu=1 ;; 394 | --skip) skip_intro=1 ;; 395 | --skip-title) 396 | [ $# -lt 2 ] && die "missing argument!" 397 | skip_title="$2" 398 | shift 399 | ;; 400 | -N | --nextep-countdown) search=nextep ;; 401 | -U | --update) update_script ;; 402 | *) query="$(printf "%s" "$query $1" | sed "s|^ ||;s| |+|g")" ;; 403 | esac 404 | shift 405 | done 406 | [ "$use_external_menu" = "0" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-m"}" 407 | [ "$use_external_menu" = "1" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-multi-select"}" 408 | printf "\33[2K\r\033[1;34mChecking dependencies...\033[0m\n" 409 | dep_ch "curl" "sed" "grep" || true 410 | [ "$skip_intro" = 1 ] && (dep_ch "ani-skip" || true) 411 | if [ -z "$ANI_CLI_NON_INTERACTIVE" ]; then dep_ch fzf || true; fi 412 | case "$player_function" in 413 | debug) ;; 414 | download) dep_ch "ffmpeg" "aria2c" ;; 415 | flatpak*) 416 | dep_ch "flatpak" 417 | flatpak info io.mpv.Mpv >/dev/null 2>&1 || die "Program \"mpv (flatpak)\" not found. Please install it." 418 | ;; 419 | android*) printf "\33[2K\rChecking of players on Android is disabled\n" ;; 420 | *iSH*) printf "\33[2K\rChecking of players on iOS is disabled\n" ;; 421 | *) dep_ch "$player_function" ;; 422 | esac 423 | 424 | # searching 425 | case "$search" in 426 | history) 427 | anime_list=$(while read -r ep_no id title; do process_hist_entry & done <"$histfile") 428 | wait 429 | [ -z "$anime_list" ] && die "No unwatched series in history!" 430 | result=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) 431 | [ -z "$result" ] && exit 1 432 | resfile="$(mktemp)" 433 | grep "$result" "$histfile" >"$resfile" 434 | read -r ep_no id title <"$resfile" 435 | ep_list=$(episodes_list "$id") 436 | ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null 437 | allanime_title="$(printf "%s" "$title" | cut -d'(' -f1 | tr -d '[:punct:]')" 438 | ;; 439 | *) 440 | if [ "$use_external_menu" = "0" ]; then 441 | while [ -z "$query" ]; do 442 | printf "\33[2K\r\033[1;36mSearch anime: \033[0m" && read -r query 443 | done 444 | else 445 | [ -z "$query" ] && query=$(printf "" | external_menu "" "Search anime: ") 446 | [ -z "$query" ] && exit 1 447 | fi 448 | # for checking new releases by specifying anime name 449 | [ "$search" = "nextep" ] && time_until_next_ep "$query" 450 | 451 | query=$(printf "%s" "$query" | sed "s| |+|g") 452 | anime_list=$(search_anime "$query") 453 | [ -z "$anime_list" ] && die "No results found!" 454 | [ "$index" -eq "$index" ] 2>/dev/null && result=$(printf "%s" "$anime_list" | sed -n "${index}p") 455 | [ -z "$index" ] && result=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: ") 456 | [ -z "$result" ] && exit 1 457 | title=$(printf "%s" "$result" | cut -f2) 458 | allanime_title="$(printf "%s" "$title" | cut -d'(' -f1 | tr -d '[:punct:]')" 459 | id=$(printf "%s" "$result" | cut -f1) 460 | ep_list=$(episodes_list "$id") 461 | [ "$skip_intro" = 1 ] && mal_id="$(ani-skip -q "${skip_title:-${title}}")" 462 | [ -z "$ep_no" ] && ep_no=$(printf "%s" "$ep_list" | nth "Select episode: " "$multi_selection_flag") 463 | [ -z "$ep_no" ] && exit 1 464 | ;; 465 | esac 466 | 467 | # moves the cursor up one line and clears that line 468 | tput cuu1 && tput el 469 | # stores the positon of cursor 470 | tput sc 471 | 472 | # playback & loop 473 | play 474 | [ "$player_function" = "download" ] || [ "$player_function" = "debug" ] && exit 0 475 | 476 | while cmd=$(printf "next\nreplay\nprevious\nselect\nchange_quality\nquit" | nth "Playing episode $ep_no of $title... "); do 477 | case "$cmd" in 478 | next) ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null ;; 479 | replay) episode="$replay" ;; 480 | previous) ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{g;1!p;};h") 2>/dev/null ;; 481 | select) ep_no=$(printf "%s" "$ep_list" | nth "Select episode: " "$multi_selection_flag") ;; 482 | change_quality) 483 | episode=$(printf "%s" "$links" | launcher) 484 | quality=$(printf "%s" "$episode" | grep -oE "^[0-9]+") 485 | episode=$(printf "%s" "$episode" | cut -d'>' -f2) 486 | ;; 487 | *) exit 0 ;; 488 | esac 489 | [ -z "$ep_no" ] && die "Out of range" 490 | play 491 | done 492 | 493 | # ani-cli 494 | # 495 | # This program is free software: you can redistribute it and/or modify 496 | # it under the terms of the GNU General Public License as published by 497 | # the Free Software Foundation, either version 3 of the License, or 498 | # (at your option) any later version. 499 | # 500 | # This program is distributed in the hope that it will be useful, 501 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 502 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 503 | # GNU General Public License for more details. 504 | # 505 | # You should have received a copy of the GNU General Public License 506 | # along with this program. If not, see <http://www.gnu.org/licenses/>. 507 | # 508 | # Project repository: https://github.com/pystardust/ani-cli 509 | -------------------------------------------------------------------------------- /ani-cli.1: -------------------------------------------------------------------------------- 1 | .TH "ANI-CLI" "1" "January 2023" "ani-cli" "User Commands" 2 | .SH NAME 3 | ani-cli \- watch anime from the commandline 4 | .SH SYNOPSIS 5 | .B ani-cli 6 | [\fI\,OPTIONS\/\fR] 7 | .SH DESCRIPTION 8 | A shell script to browse and search anime from the command-line. 9 | .PD 0 10 | .P 11 | .PD 12 | This tool scrapes the site allanime. 13 | .PD 0 14 | .P 15 | .PD 16 | \f[B]ani-cli\f[R] without options defaults to iina on macOS, flatpak mpv on Steamdeck, mpv apk on android, vlc on iOS and mpv media player everywhere else. 17 | .SH OPTIONS 18 | .TP 19 | \fB\-e | --episode | -r | --range\fR \fI\,<episode>\/\fR 20 | Specify the episode numbers to watch. If range is specified it should be quoted or separated by a non-numeric character (eg. -). 21 | .TP 22 | \fB\-c | --continue\fR 23 | Continue watching anime from history. 24 | .TP 25 | \fB\-d | --download\fR 26 | Download episode. 27 | .TP 28 | \fB\-D | --delete\fR 29 | Delete history. 30 | .TP 31 | \fB\-h | --help\fR 32 | Show summary of options. 33 | .TP 34 | \fB\-q | --quality\fR \fI\,<best|worst|360|480|720|1080>\/\fR 35 | Set the video quality. Default quality is best. 36 | .TP 37 | \fB\-s | --syncplay\fR 38 | Watch anime together with friends, using Syncplay (works with mpv only). 39 | .TP 40 | \fB\-U | --update\fR 41 | Fetch update from github. 42 | .TP 43 | \fB\-v | --vlc\fR 44 | Use VLC as the media player. 45 | .TP 46 | \fB\-S | --select-nth\fR \fI\,<index>\/\fR 47 | Selects nth entry. 48 | .TP 49 | \fB\-N | --nextep-countdown\fR 50 | Prints a countdown to the next episode as the last episode in the list. If in history is after the current episode. 51 | .TP 52 | \fB\--dub\fR 53 | Play the dubbed version. Without this flag, it'll always play the subbed version. 54 | .TP 55 | \fB\--rofi\fR 56 | Use rofi instead of fzf for the interactive menu 57 | .TP 58 | \fB\--skip\fR 59 | Use ani-skip to skip the intro of the episode (mpv only) 60 | .TP 61 | \fB\--no-detach\fR 62 | Don't detach the player (useful for in-terminal playback, mpv only) 63 | .TP 64 | \fB\--skip-title\fR \fI\,<title>\/\fR 65 | Specify the title to use for ani-skip 66 | .PP 67 | .SH 68 | ENVIRONMENT VARIABLES 69 | .PP 70 | ani-cli v4 uses environment variables to control unstable/untested and niche features in addition to everything that has an option. Command-line options take precedence over env vars. Note that these are all subject to change. 71 | .TP 72 | \fBANI_CLI_MODE\fR 73 | Controls the scraped media's mode, valid options are sub or dub. Default is sub. 74 | .TP 75 | \fBANI_CLI_DOWNLOAD_DIR\fR 76 | Controls the directory where files are downloaded. Default is the current dir. 77 | .TP 78 | \fBANI_CLI_QUALITY\fR 79 | Controls the scraped media's quality, check allanime for valid options or set to worst/best. Default is best. 80 | .TP 81 | \fBANI_CLI_PLAYER\fR 82 | Sets the player ani-cli uses. Can be debug (print links), download (equivalent to -d), android_mpv (apk and am start), android_vlc (apk and am start), flatpak_mpv (for flatpak), catt (for streaming to tv), or any player that can play urls. For defaults see working without arguments. 83 | .TP 84 | \fBANI_CLI_EXTERNAL_MENU\fR 85 | Controls the frontend of ani-cli. Can be 0 (uses fzf) or 1 (uses rofi dmenu). Default is 0. 86 | .TP 87 | \fBANI_CLI_MULTI_SELECTION\fR 88 | Controls the multi flag for the chosen frontend. Default is -m for fzf and --multi-select for rofi dmenu. 89 | .TP 90 | \fBANI_CLI_NON_INTERACTIVE\fR 91 | Enabled by default if both -e and -S are given. Disables fzf dependency check. Also disables some debug information if running with ANI_CLI_PLAYER="debug" 92 | .TP 93 | \fBANI_CLI_HIST_DIR\fR 94 | Controls the directory ani-cli uses for storing history. A /ani-cli subfolder is created there for the histfile if doesn't exists. Default is $XDG_STATE_HOME if set, $HOME/.local/state if not. 95 | .TP 96 | \fBANI_CLI_DEFAULT_SOURCE\fR 97 | Controls the default source. Valid is history (equivalent to -c), everything else means search. Default is search. 98 | .TP 99 | \fBANI_CLI_SKIP_INTRO\fR 100 | Controls if ani-skip is used to skip intros (works with mpv only). Can be 0 (disabled) or 1 (enabled). Default is 0. 101 | .TP 102 | \fBANI_CLI_NO_DETACH\fR 103 | Controls if mpv is detached from the main process for playback, which can be useful for use with terminal renderers such as kitty. (works with mpv only). Can be 0 (disabled) or 1 (enabled). Default is 0. 104 | .TP 105 | \fBANI_CLI_SKIP_TITLE\fR 106 | Overrides the anime title to query for skip times. Can be any string value. Default is empty, resolving to the anime title as given by ani-cli. 107 | .PP 108 | .SH EPISODE SELECTION 109 | .PP 110 | Multiple episodes can be chosen using fzf (or alternative frontend's) multi-selection mode. For this refer to their instructions. 111 | .SH BUGS 112 | .PP 113 | Use the GitHub issue tracker: 114 | https://github.com/pystardust/ani-cli/issues 115 | .SH COPYRIGHT 116 | .PP 117 | ani-cli is licensed under the GNU General Public License v3.0 118 | .PP 119 | This program is free software: you can redistribute it and/or modify 120 | it under the terms of the GNU General Public License as published by 121 | the Free Software Foundation, either version 3 of the License, or 122 | (at your option) any later version. 123 | .PP 124 | This program is distributed in the hope that it will be useful, 125 | but WITHOUT ANY WARRANTY; without even the implied warranty of 126 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 127 | GNU General Public License for more details. 128 | .PP 129 | You should have received a copy of the GNU General Public License 130 | along with this program. If not, see <http://www.gnu.org/licenses/>. 131 | -------------------------------------------------------------------------------- /disclaimer.md: -------------------------------------------------------------------------------- 1 | 2 | <h1 align="center">Disclaimer</h1> 3 | 4 | <div align="center"> 5 | 6 | <h2>This project: ani-cli</h2> 7 | 8 | <br> 9 | 10 | The core aim of this project is to co-relate automation and efficiency to extract what is provided to a user on the internet. All content available through the project is hosted by external non-affiliated sources. 11 | 12 | <br> 13 | 14 | <b>Any content served through this project is publicly accessible. If your site is listed in this project, the code is pretty much public. Take necessary measures to counter the exploits used to extract content in your site.</b> 15 | 16 | Think of this project as your normal browser, but a bit more straight-forward and specific. While an average browser makes hundreds of requests to get everything from a site, this project goes on to make requests associated with only getting the content served by the sites. 17 | 18 | <b> 19 | 20 | This project is to be used at the user's own risk, based on their government and laws. 21 | 22 | This project has no control on the content it is serving, using copyrighted content from the providers is not going to be accounted for by the developer. It is the user's own risk. 23 | 24 | </b> 25 | 26 | <br> 27 | 28 | <h2>DMCA and Copyright Infrigements</h3> 29 | 30 | <br> 31 | 32 | <b> 33 | A browser is a tool, and the maliciousness of the tool is directly based on the user. 34 | </b> 35 | 36 | This project uses client-side content access mechanisms. Hence, the copyright infrigements or DMCA in this project's regards are to be forwarded to the associated site by the associated notifier of any such claims. As of writing this is [allanime](https://allanime.to) 37 | 38 | <b> Do not harass the maintainer. </b> 39 | 40 | <h2> 41 | Contacting the maintainer 42 | </h2> 43 | <br> 44 | 45 | Begin by making a GitHub issue or sending an email to port19@port19.xyz 46 | </div> 47 | -------------------------------------------------------------------------------- /hacking.md: -------------------------------------------------------------------------------- 1 | # Hacking ani-cli 2 | Ani-cli is set up to scrape one platform - currently allanime. Supporting multiple sources at a time would require more changes than we (the maintainers) find worth doing, for this reason any feature request asking for a new site is rejected. 3 | 4 | However ani-cli being open-source and the pirate anime streaming sites being so similar you can hack ani-cli to support any site that follows a few conventions. 5 | 6 | ## Prequisites 7 | Here's the of skills you'll need and the guide will take for granted: 8 | - basic shell scripting 9 | - understanding of http(s) requests and proficiency with curl 10 | - ability to read html and javascript on a basic level and search them 11 | - writing regexes 12 | You'll also need web browser with a debugger and environment that can run unmodified ani-cli 13 | 14 | ## The scraping process 15 | The following flowchart demonstrates how ani-cli operates from a scraping standpoint: 16 | 17 | ![image](.assets/ani-cli-scraping-flow.png) 18 | 19 | The steps to get to a link from a query is the following: 20 | 1. search with the site's search page for the query 21 | 2. extract IDs from response, user chooses one 22 | 3. extract episode numbers from an overview page, user chooses one 23 | 4. download player(s) for that id+episode number combination, extract links 24 | 5. quality selection selects one that is played 25 | From here 1-4 need to be changed to support another site. #Reverse-engineering will answer how. 26 | 27 | ## Reverse-engineering 28 | Many sites have various protections against reverse-engineering. 29 | The extension webapi-blocker can help you with bringing up the debugger that we'll use during this guide or to conceal the presence of a debugger. 30 | These reverse-engineering protections are always evolving though so there's no silver bullet - you'll have to do your own research on how to get around them. 31 | 32 | An adblocker can help with reducing traffic from the site, but beware of extensions that change the appearance of the site (eg. darkreader) because they can alter the html/css. 33 | 34 | Once you have the pages (urls) that you're interested in, it's easier to inspect them from less/an editor. 35 | The debugger's inspector can help you with finding what's what but finding patterns/urls is much easier in an editor. 36 | Additionally the debugger doesn't always show you the html faithfully - I've experineced some escape sequences being rendered, capitalization changing - so be sure you see the response of the servers in raw format before you write your regexes. 37 | 38 | ### Core concepts 39 | If you navigate the site normally from the browser, you'll see that each anime is represented with an URL that compromises from an ID (that identifies a series/season of series) and an episode number. 40 | The series identifier is stored in the `id` variable by the script and the episode number in the `ep_no` number. 41 | 42 | Each episode has an embedded player that contains the links to the videos to be played. 43 | Your goal is to get these links along with the resolution (quality) of the streams. 44 | The embedded player has a separate URL from the episode page, but you can always get there from the episode page (and in some cases just by knowing the id and the episode number). 45 | 46 | ### Searching 47 | The search page is usually easy to find on these websites. The searching method varies. 48 | Some sites will have you post a database query in plaintext, some just use a get request with a single variable. 49 | Just try searching for a few series and see how the URL changes (most of the times the sites use a get request for this purpose). 50 | If the site uses a POST request or a more roundabout way, use the debugger to analyze the traffic. 51 | 52 | Once you figured out how searching works, you'll have to replicate it in the `search_anime` function. 53 | The `curl` in this function is responsible for the search request, and the following `sed` regexes mold the respons into many lines of `id\ttitle` format. 54 | The reason for this is the `nth` function, see it for more details. 55 | You'll have to change some variables in the process (eg. allanime_base) too. 56 | 57 | If you have done everything correctly, you can run `ani-cli`, query your site of choice and select from the responses. 58 | Then ani-cli should fail without a message. 59 | If it fails with `No results found!` you have debugging to do. 60 | Running ani-cli with `sh -x` is a good way to debug. 61 | 62 | ### Episode selection 63 | Having completed the previous step, the `id` and `title` will contain the selected title and the corresponding id. 64 | 65 | Now you'll have to look at the page where all the episodes of the series are listed. 66 | This might be a series overview page (like with allanime) or there might not be such, but the episode pages have links to all episodes. 67 | 68 | You'll have to edit the `episodes_list` function that downloads this list of urls. 69 | You need to rewrite the web request and the following regexes to achieve a list of episode numbers separated by newlines and preferably sorted. 70 | Again the `nth` function is used to offer a selection. 71 | 72 | If you have done everything correctly, now you can search for a title, get its episodes listed and select an episode. 73 | Then ani-cli should fail with `Episode not released!` 74 | 75 | ### Getting the player embed 76 | After selecting an episode, the next step is to load its page and extract the embed(s). 77 | In case you can get them without loading the episode page, replace from the `get the embed urls...` part of the code to the removal of the cache dir with a single call to `get_links` and load its output into `links`. 78 | Then move to the next step (and remove all functions rendered unused). 79 | 80 | The first request is to get the episode page, then the following commands extract the embed players' links, one at a line with the format `sourcename : url`. 81 | These are listed into `resp`. 82 | From here they are separated and parsed by `provider_init` and the first half onf `generate_link`. 83 | Some sites (like allanime) have these urls not in plaintext but "encrypted". The decrypt allanime function does this post-processing, it might need to be changed or discarded completely. 84 | 85 | If there's only one embed source, the `generate links..` block can be reduced to a single call to `generate_link`. 86 | The current structure does the agregation of many providers asynchronously, but this is not needed if there's only one source. 87 | 88 | ### Extracting the media links 89 | 90 | Once you have the embed player, it needs to be parsed for the media link. 91 | This is done in the script with the `get_links` function. 92 | 93 | Here first the embed player is first requested and loaded into `episode_link` the media links are extracted. 94 | They need to be printed to the function's stdout in a format of `quality >link`. 95 | The quality string needs to be extracted from the player along with the link and is supposed to be a numeric representation of the resolution. 96 | Sometimes a resolution can't be determined, in this case have the regex match for whatever is in its place. 97 | 98 | The output of the `get_links` function needs to be concatenated into the `links` variable - with a single call if there's only one source, or with the asynchronous mode if there are more. 99 | From here the `get_episode_url` function will continue with quality selection which you need not to alter. 100 | 101 | ## Other functionality 102 | Assuming you completed all the necessary modifications, ani-cli should completely work for you now. 103 | The UI and the history system works as long as you keep the structure of the original code and the format of the responses. 104 | 105 | There might be cases that can't be covered by the current structure of ani-cli, but still it works for most sites as I've observed. 106 | 107 | ## UX Spec 108 | 109 | There also exists a UX spec if you want to replicate the ani-cli user experience in a fresh codebase: 110 | ![image](.assets/ani-cli-ux-spec.png) 111 | -------------------------------------------------------------------------------- /matrix.md: -------------------------------------------------------------------------------- 1 | To get invited to ani-cli matrix space send an email to `8klv0leh7 at mozmail.com` with the following contents: 2 | ``` 3 | Subject: ani-cli matrix space invite 4 | Body: @yourusername:matrixserver 5 | ``` 6 | 7 | It might take some time before you get invited. 8 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs ? import <nixpkgs> {}, 3 | withMpv ? true, 4 | withVlc ? false, 5 | withIina ? false, 6 | chromecastSupport ? false, 7 | syncSupport ? false 8 | }: 9 | 10 | # To start the dev shell use the comment nix-shell 11 | # use --arg withVlc true to use VLC 12 | # use --arg withIina true to use Iina 13 | # use --arg chromecastSupport true to use chromecastSupport 14 | # use --arg syncSupport true to use syncSupport 15 | 16 | assert withMpv || withVlc || withIina; 17 | 18 | with pkgs; 19 | mkShell { 20 | name = "ani-cli dev shell"; 21 | buildInputs = [ shfmt shellcheck (ani-cli.override ({ withMpv = withMpv; withVlc = withVlc; withIina = withIina; chromecastSupport = chromecastSupport; syncSupport = syncSupport; })).runtimeDependencies ]; 22 | } 23 | --------------------------------------------------------------------------------