This guide have some instructions and tips on how to create a new Aniyomi extension. Please **read it carefully** if you're a new contributor or don't have any experience on the required languages and knowledge.
This guide have some instructions and tips on how to create a new Aniyomi extension. Please **read
it carefully** if you're a new contributor or don't have any experience on the required languages
and knowledges.
This guide is not definitive and it's being updated over time. If you find any issue on it, feel free to report it through a [Meta Issue](https://github.com/yuzono/anime-extensions/issues/new?assignees=&labels=Meta+request&template=request_meta.yml) or fixing it directly by submitting a Pull Request.
This guide is not definitive and it's being updated over time. If you find any issue on it, feel
free to report it through a [Meta Issue](https://github.com/yuzono/anime-extensions/issues/new?assignees=&labels=Meta+request&template=06_request_meta.yml)
or fixing it directly by submitting a Pull Request.
## Table of Contents
@@ -14,14 +18,14 @@ This guide is not definitive and it's being updated over time. If you find any i
- [Getting help](#getting-help)
- [Writing an extension](#writing-an-extension)
- [Setting up a new Gradle module](#setting-up-a-new-gradle-module)
- [Loading a subset of Gradle modules](#loading-a-subset-of-gradle-modules)
@@ -56,7 +61,8 @@ This guide is not definitive and it's being updated over time. If you find any i
## Prerequisites
Before you start, please note that the ability to use following technologies is **required** and that existing contributors will not actively teach them to you.
Before you start, please note that the ability to use following technologies is **required** and
that existing contributors will not actively teach them to you.
Some alternative steps can be followed to ignore "repo" branch and skip unrelated sources, which will make it faster to pull, navigate and build. This will also reduce disk usage and network traffic.
Some alternative steps can be followed to skip unrelated sources, which will make it faster to pull,
navigate and build. This will also reduce disk usage and network traffic.
**These steps are only needed when the repo is huge and contains a lot of sources. If the repo is
small, just do a normal full clone instead.**
<details><summary>Steps</summary>
1.Make sure to delete "repo" branch in your fork. You may also want to disable Actions in the repo settings.
**Also make sure you are using the latest version of Git as many commands used here are pretty new.**
@@ -185,17 +184,31 @@ and [negative refspecs](https://github.blog/2020-10-19-git-2-29-released/#user-c
## Getting help
- There are some features and tricks that are not explored in this document. Refer to existing extension code for examples.
- Join [the Discord server](https://discord.gg/85MZhUX688) for online help and to ask questions while
developing your extension. When doing so, please ask it in the `#dev` channel.
- There are some features and tricks that are not explored in this document. Refer to existing
extension code for examples.
## Writing an extension
The quickest way to get started is to copy an existing extension's folder structure and renaming it as needed. We also recommend reading through a few existing extensions' code before you start.
The quickest way to get started is to copy an existing extension's folder structure and renaming it
as needed. We also recommend reading through a few existing extensions' code before you start.
### Setting up a new Gradle module
Each extension should reside in `src/<lang>/<mysourcename>`. Use `all` as `<lang>` if your target source supports multiple languages or if it could support multiple sources.
Each extension should reside in `src/<lang>/<mysourcename>`. Use `all` as `<lang>` if your target
source supports multiple languages or if it could support multiple sources.
The `<lang>` used in the folder inside `src` should be the major `language` part. For example, if you will be creating a `pt-BR` source, use `<lang>` here as `pt` only. Inside the source class, use the full locale string instead.
The `<lang>` used in the folder inside `src` should be the major `language` part. For example, if
you will be creating a `pt-BR` source, use `<lang>` here as `pt` only. Inside the source class, use
the full locale string instead.
### Loading a subset of Gradle modules
By default, all individual and generated multisrc extensions are loaded for local development.
This may be inconvenient if you only need to work on one extension at a time.
To adjust which modules are loaded, make adjustments to the `settings.gradle.kts` file as needed.
#### Extension file structure
@@ -206,7 +219,6 @@ $ tree src/<lang>/<mysourcename>/
src/<lang>/<mysourcename>/
├── AndroidManifest.xml (optional)
├── build.gradle
├── build.gradle
├── res
│ ├── mipmap-hdpi
│ │ └── ic_launcher.png
@@ -216,9 +228,8 @@ src/<lang>/<mysourcename>/
│ │ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ └── web_hi_res_512.png
│ └── mipmap-xxxhdpi
│ └── ic_launcher.png
└── src
└── eu
└── kanade
@@ -253,81 +264,86 @@ ext {
apply from: "$rootDir/common.gradle"
```
| Field | Description |
| ----- | ----------- |
| `extName` | The name of the extension. Should be romanized if site name is not in English.|
| `extClass` | Points to the class that implements `AnimeSource`. You can use a relative path starting with a dot (the package name is the base path). This is used to find and instantiate the source(s). |
| `extVersionCode` | The extension version code. This must be a positive integer and incremented with any change to the code. |
| `isNsfw` | (Optional, defaults to `false`) Flag to indicate that a source contains NSFW content. |
| `extName` | The name of the extension. Should be romanized if site name is not in English.|
| `extClass` | Points to the class that implements `AnimeSource`. You can use a relative path starting with a dot (the package name is the base path). This is used to find and instantiate the source(s). |
| `extVersionCode` | The extension version code. This must be a positive integer and incremented with any change to the code. |
| `isNsfw` | (Optional, defaults to `false`) Flag to indicate that a source contains NSFW content. |
The extension's version name is generated automatically by concatenating `14` and `extVersionCode`. With the example used above, the version would be `14.1`.
The extension's version name is generated automatically by concatenating `14` and `extVersionCode`.
With the example used above, the version would be `14.1`.
### Core dependencies
#### Extension API
Extensions rely on [extensions-lib](https://github.com/komikku-app/aniyomi-extensions-lib), which provides some interfaces and stubs from the [app](https://github.com/komikku-app/anikku) for compilation purposes. The actual implementations can be found [here](https://github.com/komikku-app/anikku/tree/master/app/src/main/java/eu/kanade/tachiyomi/animesource). Referencing the actual implementation will help with understanding extensions' call flow.
Extensions rely on [extensions-lib](https://github.com/komikku-app/aniyomi-extensions-lib), which provides
some interfaces and stubs from the [app](https://github.com/komikku-app/anikku) for compilation
purposes. The actual implementations can be found [here](https://github.com/komikku-app/anikku/tree/master/app/src/main/java/eu/kanade/tachiyomi/animesource).
Referencing the actual implementation will help with understanding extensions' call flow.
#### CryptoAES library
#### DataImage library
The [`cryptoaes`](https://github.com/yuzono/anime-extensions/tree/master/lib/cryptoaes) provides utilities for decrypting AES-encrypted data, like data encrypted with AES+EvpKDF (The key-derivation algorithm used by the [cryptojs](https://cryptojs.gitbook.io/docs/) library). It also includes some utilities to decrypt strings in the [jsfuck](https://jsfuck.com/) format.
[`lib-dataimage`](https://github.com/yuzono/anime-extensions/tree/master/lib/dataimage) is a library
or handling [base 64 encoded image data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs)
using an [OkHttp interceptor](https://square.github.io/okhttp/interceptors/).
```groovy
dependencies {
implementation(project(":lib:cryptoaes"))
implementation(project(':lib-dataimage'))
}
```
#### Unpacker library
#### i18n library
The [`unpacker`](https://github.com/yuzono/anime-extensions/tree/master/lib/unpacker) library provides a deobfuscator(unpacker) for javascript code obfuscated with the [jspacker](http://dean.edwards.name/packer/) algorithm.
[`lib-i18n`](https://github.com/yuzono/anime-extensions/tree/master/lib/i18n) is a library for handling
internationalization in the sources. It allows loading `.properties` files with messages located under
the `assets/i18n` folder of each extension, that can be used to translate strings under the source.
```groovy
dependencies {
implementation(project(":lib:unpacker"))
}
```
#### Synchrony library
[`synchrony`](https://github.com/yuzono/anime-extensions/tree/master/lib/synchrony) is a library that bundles and runs the [synchrony](https://github.com/relative/synchrony) deobfuscator with your extension to help when deobfuscating obfuscated javascript. Useful to get data on highly obfuscated javascript code.
```groovy
dependencies {
implementation(project(":lib:synchrony"))
implementation(project(':lib-i18n'))
}
```
#### Additional dependencies
If you find yourself needing additional functionality, you can add more dependencies to your `build.gradle` file.
Many of [the dependencies](https://github.com/komikku-app/anikku/blob/master/app/build.gradle.kts) from the main Anikku app are exposed to extensions by default.
If you find yourself needing additional functionality, you can add more dependencies to your `build.gradle`
file. Many of [the dependencies](https://github.com/komikku-app/anikku/blob/master/app/build.gradle.kts)
from the app are exposed to extensions by default.
> Note that several dependencies are already exposed to all extensions via Gradle version catalog.
> To view which are available view `libs.versions.toml` under the `gradle` folder
> [!NOTE]
> Several dependencies are already exposed to all extensions via Gradle's version catalog.
> To view which are available check the `gradle/libs.versions.toml` file.
Notice that we're using `compileOnly` instead of `implementation` if the app already contains it. You could use `implementation` instead for a new dependency, or you prefer not to rely on whatever the main app has at the expense of app size.
Notice that we're using `compileOnly` instead of `implementation` if the app already contains it.
You could use `implementation` instead for a new dependency, or you prefer not to rely on whatever
the main app has at the expense of app size.
Note that using `compileOnly` restricts you to versions that must be compatible with those used in [the latest stable version of Anikku](https://github.com/komikku-app/anikku/releases/latest).
> [!IMPORTANT]
> Using `compileOnly` restricts you to versions that must be compatible with those used in
> [the latest stable version of the app](https://github.com/komikku-app/anikku/releases/latest).
### Extension main class
The class which is referenced and defined by `extClass` in `build.gradle`. This class should implement either `AnimeSourceFactory` or extend one of the `AnimeSource` implementations: `AnimeHttpSource` or `ParsedAnimeHttpSource`.
The class which is referenced and defined by `extClass` in `build.gradle`. This class should implement
either `AnimeSourceFactory` or extend one of the `AnimeSource` implementations: `AnimeHttpSource` or `ParsedAnimeHttpSource`.
| Class | Description |
| ----- | ----------- |
|`AnimeSourceFactory`| Used to expose multiple `AnimeSource`s. Use this in case of a source that supports multiple languages or mirrors of the same website. For similar websites use [theme sources](#multi-source-themes). |
| `AnimeHttpSource`| For online source, where requests are made using HTTP. |
| `ParsedAnimeHttpSource`| Similar to `AnimeHttpSource`, but has methods useful for scraping pages. |
|`AnimeSourceFactory`| Used to expose multiple `AnimeSource`s. Use this in case of a source that supports multiple languages or mirrors of the same website. |
| `AnimeHttpSource`| For online source, where requests are made using HTTP. |
| `ParsedAnimeHttpSource`| Deprecated, use `AnimeHttpSource` instead. |
#### Main class key variables
| Field | Description |
|----- | -----------|
| `name` | Name displayed in the "Sources" tab in Anikku. |
| `baseUrl` | Base URL of the source without any trailing slashes. |
| `lang` | An ISO 639-1 compliant language code (two letters in lower case in most cases, but can also include the country/dialect part by using a simple dash character). |
| `id` | Identifier of your source, automatically set in `AnimeHttpSource`. It should only be manually overriden if you need to copy an existing autogenerated ID. |
| `name` | Name displayed in the "Sources" tab in the app. |
| `baseUrl` | Base URL of the source without any trailing slashes. |
| `lang` | An ISO 639-1 compliant language code (two letters in lower case in most cases, but can also include the country/dialect part by using a simple dash character). |
| `id` | Identifier of your source, automatically set in `AnimeHttpSource`. It should only be manually overriden if you need to copy an existing autogenerated ID. |
### Extension call flow
@@ -335,40 +351,51 @@ The class which is referenced and defined by `extClass` in `build.gradle`. This
a.k.a. the Browse source entry point in the app (invoked by tapping on the source name).
- The app calls `fetchPopularAnime` which should return a `AnimesPage` containing the first batch of found `SAnime` entries.
- This method supports pagination. When user scrolls the manga list and more results must be fetched, the app calls it again with increasing `page` values(starting with `page=1`). This continues while `AnimesPage.hasNextPage` is passed as `true` and `AnimesPage.mangas` is not empty.
- To show the list properly, the app needs `url`, `title` and `thumbnail_url`. You **must** set them here. The rest of the fields could be filled later.(refer to Anime Details below).
- You should set `thumbnail_url` if is available, if not, `fetchAnimeDetails` will be **immediately** called. (this will increase network calls heavily and should be avoided).
- The app calls `fetchPopularAnime` which should return a `AnimesPage` containing the first batch of
found `SAnime` entries.
- This method supports pagination. When user scrolls the anime list and more results must be fetched,
the app calls it again with increasing `page` values (starting with `page=1`). This continues while
`AnimesPage.hasNextPage` is passed as `true` and `AnimesPage.animes` is not empty.
- To show the list properly, the app needs `url`, `title` and `thumbnail_url`. You **must** set them
here. The rest of the fields could be filled later (refer to Anime Details below).
#### Latest Anime
a.k.a. the Latest source entry point in the app (invoked by tapping on the "Latest" button beside the source name).
a.k.a. the Latest source entry point in the app (invoked by tapping on the "Latest" button beside
the source name).
- Enabled if `supportsLatest` is `true` for a source
- Similar to popular anime, but should be fetching the latest entries from a source.
#### Anime Search
- When the user searches inside the app, `fetchSearchAnime` will be called and the rest of the flow is similar to what happens with `fetchPopularAnime`.
- When the user searches inside the app, `fetchSearchAnime` will be called and the rest of the flow
is similar to what happens with `fetchPopularAnime`.
- If search functionality is not available, return `Observable.just(AnimesPage(emptyList(), false))`
- `getFilterList` will be called to get all filters and filter types.
##### Filters
The search flow have support to filters that can be added to a `AnimeFilterList` inside the `getFilterList` method. When the user changes the filter's state, they will be passed to the `searchAnimeRequest`, and they can be iterated to create the request (by getting the `filter.state` value, where the type varies depending on the `AnimeFilter` used). You can check the filter types available [here](https://github.com/komikku-app/anikku/blob/master/source-api/src/main/java/eu/kanade/tachiyomi/animesource/model/AnimeFilter.kt) and in the table below.
The search flow have support to filters that can be added to a `AnimeFilterList` inside the `getAnimeFilterList`
method. When the user changes the filters' state, they will be passed to the `searchAnimeRequest`, and they
can be iterated to create the request (by getting the `filter.state` value, where the type varies
depending on the `AnimeFilter` used). You can check the filter types available [here](https://github.com/komikku-app/anikku/blob/master/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilter.kt)
and in the table below.
| Filter | State type | Description |
|------ | ---------- | ----------- |
| `AnimeFilter.Header` | None | A simple header. Useful for separating sections in the list or showing any note or warning to the user. |
| `AnimeFilter.Separator` | None | A line separator. Useful for visual distinction between sections. |
| `AnimeFilter.Select<V>` | `Int` | A select control, similar to HTML's `<select>`. Only one item can be selected, and the state is the index of the selected one. |
| `AnimeFilter.Text` | `String` | A text control, similar to HTML's `<input type="text">`. |
| `AnimeFilter.CheckBox` | `Boolean` | A checkbox control, similar to HTML's `<input type="checkbox">`. The state is `true` if it's checked. |
| `AnimeFilter.TriState` | `Int` | A enhanced checkbox control that supports an excluding state. The state can be compared with `STATE_IGNORE`, `STATE_INCLUDE` and `STATE_EXCLUDE` constants of the class. |
| `AnimeFilter.Group<V>` | `List<V>` | A group of filters (preferentially of the same type). The state will be a `List` with all the states. |
| `AnimeFilter.Sort` | `Selection` | A control for sorting, with support for the ordering. The state indicates which item index is selected and if the sorting is `ascending`. |
| `AnimeFilter.Header` | None | A simple header. Useful for separating sections in the list or showing any note or warning to the user. |
| `AnimeFilter.Separator` | None | A line separator. Useful for visual distinction between sections. |
| `AnimeFilter.Select<V>` | `Int` | A select control, similar to HTML's `<select>`. Only one item can be selected, and the state is the index of the selected one. |
| `AnimeFilter.Text` | `String` | A text control, similar to HTML's `<input type="text">`. |
| `AnimeFilter.CheckBox` | `Boolean` | A checkbox control, similar to HTML's `<input type="checkbox">`. The state is `true` if it's checked. |
| `AnimeFilter.TriState` | `Int` | A enhanced checkbox control that supports an excluding state. The state can be compared with `STATE_IGNORE`, `STATE_INCLUDE` and `STATE_EXCLUDE` constants of the class. |
| `AnimeFilter.Group<V>` | `List<V>` | A group of filters (preferentially of the same type). The state will be a `List` with all the states. |
| `AnimeFilter.Sort` | `Selection` | A control for sorting, with support for the ordering. The state indicates which item index is selected and if the sorting is `ascending`. |
All control filters can have a default state set. It's usually recommended if the source have filters to make the initial state match the popular anime list, so when the user open the filter sheet, the state is equal and represents the current anime showing.
All control filters can have a default state set. It's usually recommended if the source have filters
to make the initial state match the popular anime list, so when the user open the filter sheet, the
state is equal and represents the current anime showing.
The `AnimeFilter` classes can also be extended, so you can create new custom filters like the `UriPartFilter`:
@@ -381,90 +408,160 @@ open class UriPartFilter(displayName: String, private val vals: Array<Pair<Strin
#### Anime Details
- When user taps on an anime, `fetchAnimeDetails` and `fetchEpisodeList` will be called and the results will be cached.
- A `SAnime` entry is identified by its `url`.
- `fetchAnimeDetails` is called to update an anime's details from when it was initialized earlier.
- `SAnime.initialized` tells the app if it should call `fetchAnimeDetails`. If you are overriding `fetchAnimeDetails`, make sure to pass it as `true`.
- When user taps on a anime, `getAnimeDetails` and `getEpisodeList` will be called and the results
will be cached.
- A `SAnime` entry is identified by it's `url`.
- `getAnimeDetails` is called to update a anime's details from when it was initialized earlier.
- `SAnime.initialized` tells the app if it should call `getAnimeDetails`. If you are overriding
`getAnimeDetails`, make sure to pass it as `true`.
- `SAnime.genre` is a string containing list of all genres separated with `", "`.
- `SAnime.status` is an "enum" value. Refer to [the values in the `SAnime` companion object](https://github.com/komikku-app/aniyomi-extensions-lib/blob/main/library/src/main/java/eu/kanade/tachiyomi/animesource/model/SAnime.kt#L26-L32).
- During a backup, only `url` and `title` are stored. To restore the rest of the anime data, the app calls `fetchAnimeDetails`, so all fields should be (re)filled in if possible.
- If a `SAnime` is cached `fetchAnimeDetails` will be only called when the user does a manual update(Swipe-to-Refresh).
- `fetchEpisodeList` is called to display the episode list.
- `SAnime.status` is an "enum" value. Refer to [the values in the `SAnime` companion object](https://github.com/komikku-app/aniyomi-extensions-lib/blob/master/library/src/main/java/eu/kanade/tachiyomi/animesource/model/SAnime.kt#L24).
- During a backup, only `url` and `title` are stored. To restore the rest of the anime data, the
app calls `getAnimeDetails`, so all fields should be (re)filled in if possible.
- If a `SAnime` is cached, `getAnimeDetails` will be only called when the user does a manual
update (Swipe-to-Refresh).
- `getEpisodeList` is called to display the episode list.
- **The list should be sorted descending by the source order**.
- If `Video.videoUrl`s are available immediately, you should pass them here. Otherwise, you should set `video.url` to a page that contains them and override `videoUrlParse` to fill those `videoUrl`s.
- `getAnimeUrl` is called when the user taps "Open in WebView".
- If the source uses an API to fetch the data, consider overriding this method to return the anime
absolute URL in the website instead.
- It defaults to the URL provided to the request in `animeDetailsRequest`.
#### Episode
- After an episode list for the anime is fetched and the app is going to cache the data, `prepareNewEpisode` will be called.
- `SEpisode.date_upload` is the [UNIX Epoch time](https://en.wikipedia.org/wiki/Unix_time) **expressed in milliseconds**.
- If you don't pass `SEpisode.date_upload` and leave it zero, the app will use the default date instead, but it's recommended to always fill it if it's available.
- To get the time in milliseconds from a date string, you can use a `SimpleDateFormat` like in the example below.
- `SEpisode.date_upload` is the [UNIX Epoch time](https://en.wikipedia.org/wiki/Unix_time)
**expressed in milliseconds**.
- If you don't pass `SEpisode.date_upload` and leave it zero, the app will use the default date
instead, but it's recommended to always fill it if it's available.
- To get the time in milliseconds from a date string, you can use a `SimpleDateFormat` like in
Make sure you make the `SimpleDateFormat` a class constant or variable so it doesn't get recreated for every episode. If you need to parse or format dates in anime description, create another instance since `SimpleDateFormat` is not thread-safe.
- If the parsing have any problem, make sure to return `0L` so the app will use the default date instead.
Make sure you make the `SimpleDateFormat` a class constant or variable so it doesn't get
recreated for every episode. If you need to parse or format dates in anime description, create
another instance since `SimpleDateFormat` is not thread-safe.
- If the parsing have any problem, make sure to return `0L` so the app will use the default date
instead.
- The app will overwrite dates of existing old episodes **UNLESS** `0L` is returned.
- The default date has [changed](https://github.com/aniyomiorg/aniyomi/pull/7197) in Aniyomi preview ≥ r4442 or stable > 0.13.4.
- In older versions, the default date is always the fetch date.
- In newer versions, this is the same if every (new) episode has `0L` returned.
- However, if the source only provides the upload date of the latest episode, you can now set it to the latest episode and leave other episodes default. The app will automatically set it (instead of fetch date) to every new episode and leave old episodes' dates untouched.
- If the source only provides the anime's updated date, assign it to the latest episode only.
- `getEpisodeUrl` is called when the user taps "Open in WebView" in the reader.
- If the source uses an API to fetch the data, consider overriding this method to return the
episode absolute URL in the website instead.
- It defaults to the URL provided to the request in `videoListRequest`.
#### Episode Videos
- When user opens an episode, `fetchVideoList` will be called and it will return a list of `Video`s that are used by the player.
- When user opens a episode, `getVideoList` will be called and it will return a list of `Video`s.
- While a episode is open in the reader or is being downloaded, `fetchVideoUrl` will be called to get
URLs for each video of the anime if the `Video.videoUrl` is empty.
- If the source provides all the `Video.videoUrl`'s directly, you can fill them and let the `Video.url`
empty, so the app will skip the `fetchVideoUrl` source and call directly `fetchVideo`.
- The `Video.url` and `Video.videoUrl` attributes **should be set as an absolute URL**.
- Episode videos numbers start from `0`.
- The list of `Video`s should be returned already sorted, the `index` field is ignored.
### Misc notes
- Sometimes you may find no use for some inherited methods. If so just override them and throw exceptions: `throw UnsupportedOperationException()`
- You probably will find `getUrlWithoutDomain` useful when parsing the target source URLs. Keep in mind there's a current issue with spaces in the URL though, so if you use it, replace all spaces with URL encoded characters (like `%20`).
- If possible try to stick to the general workflow from `AnimeHttpSource`/`AnimeParsedHttpSource`; breaking them may cause you more headache than necessary.
- By implementing `ConfigurableAnimeSource` you can add settings to your source, which is backed by [`SharedPreferences`](https://developer.android.com/reference/android/content/SharedPreferences).
- Sometimes you may find no use for some inherited methods. If so just override them and throw
Extensions can define URL intent filters by defining it inside a custom `AndroidManifest.xml` file.
For an example, refer to [the AniWatch module's `AndroidManifest.xml` file](https://github.com/yuzono/anime-extensions/blob/master/src/en/aniwatch/AndroidManifest.xml) and [its corresponding `AniWatchUrlActivity` handler](https://github.com/yuzono/anime-extensions/blob/master/src/en/aniwatch/src/eu/kanade/tachiyomi/animeextension/en/zoro/AniWatchUrlActivity.kt).
(Example TBD.)
To test if the URL intent filter is working as expected, you can try opening the website in a browser and navigating to the endpoint that was added as a filter or clicking a hyperlink. Alternatively, you can use the `adb` command below.
To test if the URL intent filter is working as expected, you can try opening the website in a browser
and navigating to the endpoint that was added as a filter or clicking a hyperlink. Alternatively,
you can use the `adb` command below.
```console
$ adb shell am start -d "<your-link>" -a android.intent.action.VIEW
```
> [!CAUTION]
> The activity does not support any Kotlin Intrinsics specific methods or calls,
> and using them will causes crashes in the activity. Consider using Java's equivalent
> methods instead, such as using `String`'s `equals()` instead of using `==`.
>
> You can use Kotlin Intrinsics in the extension source class, this limitation only
> applies to the activity classes.
#### Update strategy
There is some cases where titles in a source will always only have the same episode list
(i.e. immutable), and don't need to be included in a global update of the app because of that, saving
a lot of requests and preventing causing unnecessary damage to the source servers. To change the
update strategy of a `SAnime`, use the `update_strategy` field. You can find below a description of
the current possible values.
- `UpdateStrategy.ALWAYS_UPDATE`: Titles marked as always update will be included in the library
update if they aren't excluded by additional restrictions.
- `UpdateStrategy.ONLY_FETCH_ONCE`: Titles marked as only fetch once will be automatically skipped
during library updates. Useful for cases where the series is previously known to be finished and have
only a single episode, for example.
If not set, it defaults to `ALWAYS_UPDATE`.
#### Renaming existing sources
There is some cases where existing sources changes their name on the website. To correctly reflect these changes in the extension, you need to explicity set the `id` to the same old value, otherwise it will get changed by the new `name` value and users will be forced to migrate back to the source.
There is some cases where existing sources changes their name on the website. To correctly reflect
these changes in the extension, you need to explicity set the `id` to the same old value, otherwise
it will get changed by the new `name` value and users will be forced to migrate back to the source.
To get the current `id` value before the name change, you can search the source name in the [repository JSON file](https://github.com/yuzono/anime-repo/blob/repo/index.json) by looking into the `sources` attribute of the extension. When you have the `id` copied, you can override it in the source:
To get the current `id` value before the name change, you can search the source name in the [repository JSON file](https://github.com/yuzono/anime-repo/blob/repo/index.json)
by looking into the `sources` attribute of the extension. When you have the `id` copied, you can
override it in the source:
```kotlin
override val id: Long = <the-id>
```
Then the class name and the `name` attribute value can be changed. Also don't forget to update the extension name and class name in the individual Gradle file if it is not a multisrc extension.
Then the class name and the `name` attribute value can be changed. Also don't forget to update the
extension name and class name in the individual Gradle file.
**Important:** the package name **needs** to be the same (even if it has the old name), otherwise users will not receive the extension update when it gets published in the repository. If you're changing the name of a multisrc source, you can manually set it in the generator class of the theme by using `pkgName = "oldpackagename"`.
> [!IMPORTANT]
> The package name **needs** to be the same (even if it has the old name), otherwise users will not
> receive the extension update when it gets published in the repository.
The `id` also needs to be explicity set to the old value if you're changing the `lang` attribute.
## Multi-source themes
The `multisrc` module houses source code for generating extensions for cases where multiple source sites use the same site generator tool(usually a CMS) for bootstraping their website and this makes them similar enough to prompt code reuse through inheritance/composition; which from now on we will use the general **theme** term to refer to.
> [!NOTE]
> If the source has also changed their theme you can instead just change
> the `name` field in the source class and in the Gradle file. By doing so
> a new `id` will be generated and users will be forced to migrate.
This module contains the *default implementation* for each theme and definitions for each source that builds upon that default implementation and also it's overrides upon that default implementation, all of this becomes a set of source code which then is used to generate individual extensions from.
## Multi-source themes
The `lib-multisrc` directory houses source code that is useful in situations where multiple source
sites use the same site generator tool (usually a CMS) for bootstrapping their website and this makes
them similar enough to prompt code reuse through inheritance/composition; which from now on we will
use the general **theme** term to refer to.
This section needs to be rewritten. Come to the `#programming` channel in our Discord server for help.
<details>
<summary>Outdated information</summary>
This module contains the *default implementation* for each theme and definitions for each source that
builds upon that default implementation and also it's overrides upon that default implementation,
all of this becomes a set of source code which then is used to generate individual extensions from.
### The directory structure
```console
@@ -484,9 +581,8 @@ multisrc
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ └── web_hi_res_512.png
│ │ └── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ └── <sourcepkg>
│ ├── additional.gradle
│ ├── AndroidManifest.xml
@@ -499,9 +595,8 @@ multisrc
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ └── web_hi_res_512.png
│ │ └── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ └── src
│ └── <SourceName>.kt
└── src
@@ -521,18 +616,24 @@ multisrc
└── ThemeSourceGenerator.kt
```
- `multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/<themepkg>/<Theme>.kt` defines the the theme's default implementation.
- `multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/<theme>/<Theme>Generator.kt` defines the the theme's generator class, this is similar to a `AnimeSourceFactory` class.
- `multisrc/overrides/<themepkg>/default/res` is the theme's default icons, if a source doesn't have overrides for `res`, then default icons will be used.
- `multisrc/overrides/<themepkg>/default/additional.gradle` defines additional gradle code, this will be copied at the end of all generated sources from this theme.
- `multisrc/overrides/<themepkg>/<sourcepkg>` contains overrides for a source that is defined inside the `<Theme>Generator.kt` class.
- `multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/<themepkg>/<Theme>.kt` defines the the theme's
default implementation.
- `multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/<theme>/<Theme>Generator.kt` defines the the
theme's generator class, this is similar to a `SourceAnimeFactory` class.
- `multisrc/overrides/<themepkg>/default/res` is the theme's default icons, if a source doesn't have
overrides for `res`, then default icons will be used.
- `multisrc/overrides/<themepkg>/default/additional.gradle` defines additional gradle code, this will
be copied at the end of all generated sources from this theme.
- `multisrc/overrides/<themepkg>/<sourcepkg>` contains overrides for a source that is defined inside
- `multisrc/overrides/<themepkg>/<sourcepkg>/res` contains override for icons.
- `multisrc/overrides/<themepkg>/<sourcepkg>/additional.gradle` defines additional gradle code, this will be copied at the end of the generated gradle file below the theme's `additional.gradle`.
- `multisrc/overrides/<themepkg>/<sourcepkg>/AndroidManifest.xml` is copied as an override to the default `AndroidManifest.xml` generation if it exists.
- `multisrc/overrides/<themepkg>/<sourcepkg>/additional.gradle` defines additional gradle code, this
will be copied at the end of the generated gradle file below the theme's `additional.gradle`.
- `multisrc/overrides/<themepkg>/<sourcepkg>/AndroidManifest.xml` is copied as an override to the
default `AndroidManifest.xml` generation if it exists.
> **Note**
>
> [!NOTE]
> Files ending with `Gen.kt` (i.e. `multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/<theme>/XxxGen.kt`)
> are considered helper files and won't be copied to generated sources.
@@ -541,19 +642,27 @@ There are three steps in running and testing a theme source:
1. Generate the sources
- **Option 1: Only generate sources from one theme**
- **Method 1:** Find and run `<ThemeName>Generator` run configuration form the `Run/Debug Configuration` menu.
- **Method 2:** Directly run `<themepkg>.<ThemeName>Generator.main` by pressing the play button in front of the method shown inside Android Studio's Code Editor to generate sources from the said theme.
- **Method 1:** Find and run `<ThemeName>Generator` run configuration from the
`Run/Debug Configuration` menu.
- **Method 2:** Directly run `<themepkg>.<ThemeName>Generator.main` by pressing the play
button in front of the method shown inside Android Studio's Code Editor to generate sources
from the said theme.
- **Option 2: Generate sources from all themes**
- **Method 1:** Run `./gradlew multisrc:generateExtensions` from a terminal window to generate all sources.
- **Method 2:** Directly run `Generator.GeneratorMain.main` by pressing the play button in front of the method shown inside Android Studio's Code Editor to generate all sources.
- **Method 1:** Run `./gradlew multisrc:generateExtensions` from a terminal window to
generate all sources.
- **Method 2:** Directly run `Generator.GeneratorMain.main` by pressing the play button
in front of the method shown inside Android Studio's Code Editor to generate all sources.
2. Sync gradle to import the new generated sources inside `generated-src`
- **Method 1:** Android Studio might prompt to sync the gradle. Click on `Sync Now`.
- **Method 2:** Manually re-sync by opening `File` -> `Sync Project with Gradle Files` or by pressing `Alt+f` then `g`.
- **Method 2:** Manually re-sync by opening `File` -> `Sync Project with Gradle Files` or by
pressing `Alt+f` then `g`.
3. Build and test the generated Extention like normal `src` sources.
- It's recommended to make changes here to skip going through step 1 and 2 multiple times, and when you are done, copying the changes back to `multisrc`.
- It's recommended to make changes here to skip going through step 1 and 2 multiple times, and
when you are done, copying the changes back to `multisrc`.
### Scaffolding overrides
You can use this python script to generate scaffolds for source overrides. Put it inside `multisrc/overrides/<themepkg>/` as `scaffold.py`.
You can use this python script to generate scaffolds for source overrides.
Put it inside `multisrc/overrides/<themepkg>/` as `scaffold.py`.
```python
import os, sys
from pathlib import Path
@@ -580,47 +689,67 @@ with open(f"{package}/src/{source}.kt", "w") as f:
```
### Additional Notes
- Generated sources extension version code is calculated as `baseVersionCode + overrideVersionCode + multisrcLibraryVersion`.
- Generated sources extension version code is calculated as
- When a new source is added, it doesn't need to set `overrideVersionCode` as it's default is `0`.
- For each time a source changes in a way that should the version increase, `overrideVersionCode` should be increased by one.
- When a theme's default implementation changes, `baseVersionCode` should be increased, the initial value should be `1`.
- For each time a source changes in a way that should the version increase, `overrideVersionCode`
should be increased by one.
- When a theme's default implementation changes, `baseVersionCode` should be increased, the
initial value should be `1`.
- For example, for a new theme with a new source, extention version code will be `0 + 0 + 1 = 1`.
- `IntelijConfigurationGeneratorMainKt` should be run on creating or removing a multisrc theme.
- On removing a theme, you can manually remove the corresponding configuration in the `.run` folder instead.
- Be careful if you're using sparse checkout. If other configurations are accidentally removed, `git add` the file you want and `git restore` the others. Another choice is to allow `/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/*` before running the generator.
- On removing a theme, you can manually remove the corresponding configuration in the `.run`
folder instead.
- Be careful if you're using sparse checkout. If other configurations are accidentally removed,
`git add` the file you want and `git restore` the others. Another choice is to allow
`/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/*` before running the generator.
</details>
## Running
To make local development more convenient, you can use the following run configuration to launch Anikku directly at the Browse panel:
For local development, use the following run configuration to launch the app directly into the Browse panel.


If you're running a Preview or debug build of Anikku:
Copy the following into `Launch Flags` for the Debug build of Anikku:
Anikku:
```
-W -S -n app.anikku.dev/eu.kanade.tachiyomi.ui.main.MainActivity -a eu.kanade.tachiyomi.SHOW_CATALOGUES
```
And for a release build of Anikku:
For other builds, replace `app.anikku.dev` with the corresponding package IDs:
- Release build: `app.anikku`
- Preview build: `app.anikku.beta`
```
-W -S -n app.anikku/eu.kanade.tachiyomi.ui.main.MainActivity -a eu.kanade.tachiyomi.SHOW_CATALOGUES
```
If the extension builds and runs successfully then the code changes should be ready to test in your local app.
If you're deploying to Android 11 or higher, enable the "Always install with package manager" option in the run configurations.
> [!IMPORTANT]
> If you're deploying to Android 11 or higher, enable the `Always install with package manager` option in the run configurations. Without this option enabled, you might face issues such as Android Studio running an older version of the extension without the modifications you might have done.
## Debugging
### Android Debugger
You can leverage the Android Debugger to step through your extension while debugging.
> [!IMPORTANT]
> If you didn't **build the main app** from source with **debug enabled** and are using a release/beta APK, you **need a rooted device**.
> If you are using an **emulator** instead, make sure you choose a profile **without Google Play**.
You *cannot* simply use Android Studio's `Debug 'module.name'` -> this will most likely result in an error while launching.
Follow the steps above for building and running locally if you haven't already. Debugging will not work if you did not follow the steps above.
Instead, once you've built and installed your extension on the target device, use `Attach Debugger to Android Process` to start debugging Anikku.
You can leverage the Android Debugger to add breakpoints and step through your extension while debugging.

You *cannot* simply use Android Studio's `Debug 'module.name'` -> this will most likely result in an
error while launching.
Instead, once you've built and installed your extension on the target device, use
`Attach Debugger to Android Process` to start debugging the app.
Inside the `Attach Debugger to Android Process` window, once the app is running on your device and `Show all processes` is checked, you should be able to select `app.anikku.dev` and press OK.

### Logs
@@ -629,17 +758,32 @@ You can also elect to simply rely on logs printed from your extension, which
show up in the [`Logcat`](https://developer.android.com/studio/debug/am-logcat) panel of Android Studio.
### Inspecting network calls
One of the easiest way to inspect network issues (such as HTTP errors 404, 429, no chapter found etc.) is to use the [`Logcat`](https://developer.android.com/studio/debug/am-logcat) panel of Android Studio and filtering by the `OkHttpClient` tag.
To be able to check the calls done by OkHttp, you need to enable verbose logging in the app, that is not enabled by default and is only included in the Preview versions of Anikku. To enable it, go to More -> Settings -> Advanced -> Verbose logging. After enabling it, don't forget to restart the app.
One of the easiest way to inspect network issues (such as HTTP errors 404, 429, no episode found etc.)
is to use the [`Logcat`](https://developer.android.com/studio/debug/am-logcat) panel of Android Studio
and filtering by the `OkHttpClient` tag.
Inspecting the Logcat allows you to get a good look at the call flow and it's more than enough in most cases where issues occurs. However, alternatively, you can also use an external tool like `mitm-proxy`. For that, refer to the next section.
To be able to check the calls done by OkHttp, you need to enable verbose logging in the app, that is
not enabled by default. To enable it, go to
More -> Settings -> Advanced -> Verbose logging. After enabling it, don't forget to restart the app.
Inspecting the Logcat allows you to get a good look at the call flow and it's more than enough in most
cases where issues occurs. However, alternatively, you can also use an external tool like `mitm-proxy`.
For that, refer to the subsequent sections.
On newer Android Studio versions, you can use its built-in Network Inspector inside the
App Inspection tool window. This feature provides a nice GUI to inspect the requests made in the app.
To use it, follow the [official documentation](https://developer.android.com/studio/debug/network-profiler)
and select the app's package name in the process list.
### Using external network inspecting tools
If you want to take a deeper look into the network flow, such as taking a look into the request and response bodies, you can use an external tool like `mitm-proxy`.
If you want to take a deeper look into the network flow, such as taking a look into the request and
response bodies, you can use an external tool like `mitm-proxy`.
#### Setup your proxy server
We are going to use [mitm-proxy](https://mitmproxy.org/) but you can replace it with any other Web Debugger (i.e. Charles, Burp Suite, Fiddler etc). To install and execute, follow the commands bellow.
We are going to use [mitm-proxy](https://mitmproxy.org/) but you can replace it with any other Web
Debugger (i.e. Charles, Burp Suite, Fiddler etc). To install and execute, follow the commands below.
After installing and running, open your browser and navigate to http://127.0.0.1:8081.
#### OkHttp proxy setup
Since most of the manga sources are going to use HTTPS, we need to disable SSL verification in order to use the web debugger. For that, add this code to inside your source class:
Since most of the anime sources are going to use HTTPS, we need to disable SSL verification in order
to use the web debugger. For that, add this code to inside your source class:
Note: `10.0.2.2` is usually the address of your loopback interface in the android emulator. If Anikku tells you that it's unable to connect to 10.0.2.2:8080 you will likely need to change it (the same if you are using hardware device).
Note: `10.0.2.2` is usually the address of your loopback interface in the android emulator. If
the app tells you that it's unable to connect to 10.0.2.2:8080 you will likely need to change it
(the same if you are using hardware device).
If all went well, you should see all requests and responses made by the source in the web interface of `mitmweb`.
If all went well, you should see all requests and responses made by the source in the web interface
of `mitmweb`.
## Building
APKs can be created in Android Studio via `Build > Build Bundle(s) / APK(s) > Build APK(s)` or `Build > Generate Signed Bundle / APK`.
APKs can be created in Android Studio via `Build > Build Bundle(s) / APK(s) > Build APK(s)` or
`Build > Generate Signed Bundle / APK`.
If for some reason you decide to build the APK from the command line, you can use the following
command (because you're doing things differently than expected, I assume you have some
knowledge of gradlew and your OS):
```console
// For a single apk, use this command
$ ./gradlew src:<lang>:<source>:assembleDebug
```
## Submitting the changes
When you feel confident about your changes, submit a new Pull Request so your code can be reviewed and merged if it's approved. We encourage following a [GitHub Standard Fork & Pull Request Workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962) and following the good practices of the workflow, such as not commiting directly to `master`: always create a new branch for your changes.
When you feel confident about your changes, submit a new Pull Request so your code can be reviewed
and merged if it's approved. We encourage following a [GitHub Standard Fork & Pull Request Workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962)
and following the good practices of the workflow, such as not commiting directly to `master`: always
create a new branch for your changes.
If you are more comfortable about using Git GUI-based tools, you can refer to [this guide](https://learntodroid.com/how-to-use-git-and-github-in-android-studio/) about the Git integration inside Android Studio, specifically the "How to Contribute to an to Existing Git Repository in Android Studio" section of the guide.
If you are more comfortable about using Git GUI-based tools, you can refer to [this guide](https://learntodroid.com/how-to-use-git-and-github-in-android-studio/)
about the Git integration inside Android Studio, specifically the "How to Contribute to an to Existing
Git Repository in Android Studio" section of the guide.
Please **do test your changes by compiling it through Android Studio** before submitting it. Also make sure to follow the PR checklist available in the PR body field when creating a new PR. As a reference, you can find it below.
> [!IMPORTANT]
> Make sure you have generated the extension icon using the linked Icon Generator tool in the [Tools](#tools)
> section. The icon **must follow the pattern** adopted by all other extensions: a square with rounded
> corners. Make sure to remove the generated `web_hi_res_512.png`.
Please **do test your changes by compiling it through Android Studio** before submitting it. Obvious
untested PRs will not be merged, such as ones created with the GitHub web interface. Also make sure
to follow the PR checklist available in the PR body field when creating a new PR. As a reference, you
can find it below.
### Pull Request checklist
- Update `extVersionCode` value in `build.gradle` for individual extensions
- Update `overrideVersionCode` or `baseVersionCode` as needed for all multisrc extensions
- Reference all related issues in the PR body (e.g. "Closes #xyz")
- Add the `isNsfw = true` flag in `build.gradle` when appropriate
- Explicitly kept the `id` if a source's name or language were changed
- Test the modifications by compiling and running the extension through Android Studio
- Updated `extVersionCode` value in `build.gradle` for individual extensions
- Updated `overrideVersionCode` or `baseVersionCode` as needed for all multisrc extensions
- Referenced all related issues in the PR body (e.g. "Closes #xyz")
- Added the `isNsfw = true` flag in `build.gradle` when appropriate
- Have not changed source names
- Have explicitly kept the `id` if a source's name or language were changed
- Have tested the modifications by compiling and running the extension through Android Studio
- Have removed `web_hi_res_512.png` when adding a new extension
@@ -14,23 +14,37 @@ Anikku/Aniyomi is a free and open source manga reader for Android 6.0 and above.
This repository contains the available extension catalogues for the [Anikku](https://github.com/komikku-app/anikku) or [Aniyomi](https://github.com/aniyomiorg/aniyomi) forks.
**If you are new to repository/extensions, please read the [Yūzōnō Getting Started guide](https://yuzono.github.io/docs/guides/getting-started#adding-the-extension-repo) first.**
* You can add our repo by visiting the [Yūzōnō Website](https://yuzono.github.io/add-repo-ani)
Extension sources can be downloaded, installed, and uninstalled via the main Anikku app. They are installed and uninstalled like regular apps, in `.apk` format.
## Downloads
### Manual downloads
If you prefer to directly download the APK files, they are available via [website](https://yuzono.github.io/extensions-aniyomi/) or directly in this GitHub repository in the [`repo` branch](https://github.com/yuzono/anime-repo/tree/repo/apk).
# Requests
## Requests
Source requests here are meant as up-for-grabs for any developer, thus it's impossible to provide a time estimation for any of them. Furthermore, some sites are impossible to do, usually because of various technical reasons.
To request a new source or bug fix, [create an issue](https://github.com/yuzono/aniyomi-extensions/issues/new/choose).
Please note that creating an issue does not mean that the source will be added or fixed in a timely
fashion, because the work is volunteer-based. Some sources may also be impossible to do or prohibitively
difficult to maintain.
If you would like to see a request fulfilled and have the necessary skills to do so, consider contributing!
Issues are up-for-grabs for any developer if there is no assigned user already.
## Contributing
@@ -42,10 +56,27 @@ To get started with development, see [CONTRIBUTING.md](./CONTRIBUTING.md).
It might also be good to read our [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
## License
Copyright 2015 Javier Tomás
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
## Disclaimer
This project does not have any affiliation with the content providers available.
This project is not affiliated with Anikku or Aniyomi.
Don't ask for help about these extensions at the official support means of Anikku or Aniyomi.
All credits to the codebase goes to the original contributors.
This project is not affiliated with Anikku/Aniyomi. Don't ask for help about these extensions at the
official support means of Anikku/Aniyomi. All credits to the codebase goes to the original contributors.
The developer of this application does not have any affiliation with the content providers available.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.