Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use animetosho api for better and more accurate searching capabilities #29

Open
P0bo opened this issue Dec 8, 2024 · 4 comments
Open

Comments

@P0bo
Copy link

P0bo commented Dec 8, 2024

https://animetosho.org/animes
https://animetosho.org/episodes

Anime Tosho is a free, automated service that mirrors most torrents from TokyoTosho's anime category, Nyaa.si's English translated anime category, and AniDex's anime category onto various file hosting services and Usenet.

API Information:

Anime Tosho provides an API through its feed system. The feed supports both RSS/Atom and JSON formats, which can be used to query torrent and file information. Below are the details for using the JSON API:

  1. Base URL: https://feed.animetosho.org/json

  2. Basic Query Example:

    • To get a specific torrent's information:
      https://feed.animetosho.org/json?show=torrent&id=451927
      
    • JSON response example:
      {
        "title": "[Golumpa] The Case Study of Vanitas - 04 (Vanitas no Karte) [English Dub] [FuniDub 720p x264 AAC] [MKV] [93E4EC07]",
        "timestamp": 1630687502,
        "status": "skipped",
        "tosho_id": null,
        "nyaa_id": 1428689,
        "anidex_id": null,
        "torrent_url": "https://animetosho.org/storage/torrent/63923e9ac5fb7828aee2f03df3e0399a65bf376c/%5BGolumpa%5D%20The%20Case%20Study%20of%20Vanitas%20-%2004%20%28Vanitas%20no%20Karte%29%20%5BFuniDub%20720p%20x264%20AAC%5D%20%5B93E4EC07%5D.torrent",
        "magnet_uri": "magnet:?xt=urn:btih:MOJD5GWF7N4CRLXC6A67HYBZTJS36N3M&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce...",
        "total_size": 462783515,
        "num_files": 1,
        "anidb_aid": 16174,
        "anidb_eid": 241210
      }
  3. Advanced Search:

    • The feed supports advanced searching using Sphinx search expressions:
      https://feed.animetosho.org/json?qx=1&q=1080p&page=100
      
    • If you remove qx=1, it will perform a normal search:
      https://feed.animetosho.org/json?q=1080p&page=100
      
  4. Filtering by AniDB IDs:

    • You can filter results by providing AniDB IDs (aids):
      https://feed.animetosho.org/json?qx=1&q=1080p&aids=69&page=10
      
    • You can supply up to 20 AniDB IDs at once, separated by commas:
      aids=69%2C75
      
    • The maximum page number is 100.

Parameters

  • show: Set this to "torrent" to get detailed information about a specific torrent.
  • id: The ID of the torrent you want to retrieve details for.
  • qx: Set this to "1" to enable query search mode.
  • q: The search query string.
  • page: Page number for pagination.
  • aids:Filter by anidb id(s).
  1. Searching Torrents by Query
    • You can search for torrents by providing a query string. The API also supports pagination.
    • URL Format:
      https://feed.animetosho.org/json?qx=1&q={query}&page={page_number}
      
    • Example:
      https://feed.animetosho.org/json?qx=1&q=1080p&page=100
      
    • Response:
      [
          {
              "id": 628768,
              "title": "[Breeze] Tsuki ga Michibiku Isekai Douchuu Dai Ni Maku | Tsukimichi -Moonlit Fantasy- S02E24 [1080p AV1][multisub]",
              "link": "https://animetosho.org/view/breeze-tsuki-ga-michibiku-isekai-douchuu-dai-ni.n1836009",
              "timestamp": 1718915161,
              "status": "complete",
              "torrent_url": "https://animetosho.org/storage/torrent/83ec99f67fd274000e1eb1dc31f988f607659406/[Breeze] Tsukimichi -Moonlit Fantasy- S02E24 [1080p AV1][multisub].torrent",
              "info_hash": "83ec99f67fd274000e1eb1dc31f988f607659406",
              "magnet_uri": "magnet:?xt=urn:btih:QPWJT5T72J2AADQ6WHODD6MI6YDWLFAG&tr=udp://open.stealth.si:80/announce",
              "nzb_url": "https://animetosho.org/storage/nzbs/00099820/[Breeze] Tsukimichi -Moonlit Fantasy- S02E24 [1080p AV1][multisub].nzb",
              "total_size": 728391346,
              "num_files": 1,
              "anidb_aid": 16786,
              "anidb_eid": 281055
          }
      ]

Response Fields

  • title: Title of the torrent.
  • timestamp: Unix timestamp of when the torrent was indexed.
  • status: Status of the torrent (e.g., complete, skipped).
  • tosho_id: ID from TokyoTosho if available.
  • nyaa_id: ID from Nyaa if available.
  • anidex_id: ID from AniDex if available.
  • torrent_url: Direct link to download the torrent file.
  • magnet_uri: Magnet URI of the torrent.
  • nzb_url: Direct link to download the NZB file if available.
  • total_size: Total size of the torrent in bytes.
  • num_files: Number of files within the torrent.
  • anidb_aid: AniDB anime ID if available.
  • anidb_eid: AniDB episode ID if available.
@P0bo
Copy link
Author

P0bo commented Dec 8, 2024

also u can use anidb title dump (cache once very day) to give search suggestions so that we dont have to remember the anime name spelling or the anidb id everytime .

https://wiki.anidb.net/API

AniDB offers a daily updated dump of all anime titles which can be used to support client sided anime search features.

This file can also be used for anime title to AID lookups.

http://anidb.net/api/anime-titles.dat.gz

YOU DO NOT REQUEST THIS FILE MORE THAN ONCE PER DAY*

http://anidb.net/api/anime-titles.xml.gz

YOU DO NOT REQUEST THIS FILE MORE THAN ONCE PER DAY*

@sweetbbak
Copy link
Owner

That should be pretty easy to add. Thanks for the detailed write up. I've been wanting to clean this project up and one of the things I wanted to do is abstract out the searching capabilities so people can easily add new providers or sources. Scraping HTML is notoriously fragile, and a lot of projects that rely on it either have to update often or they break.

I also want to kind of partition out the torrent streaming functionality from the searching functionalities so that no matter what happens to a source or the project, it will always be able to maintain the core functionality of streaming torrents as long as links/magnets can be provided. So a multitude of sources and a simple and clean way to add and use them is important.

It'd be nice to be able to write and add a new source in an hour or so by fulfilling an interface. I guess I need to find a way to register a provider so that we can define what search parameters a provider allows for, and then find an easy way to expose that to the user. A part of that would be probably moving to a different flag parsing library and potentially I would like to expose a Lua API with bindings to the html, json, and torrent server libraries so that this tool becomes a lot more flexible and general use on top of providing a more polished experience. I've just been a little distracted lately with other projects.

but I will take a look at it tomorrow. Ive been meaning to do a full rewrite since we're only at ~2K lines of code. I might as well start here.

@P0bo
Copy link
Author

P0bo commented Dec 10, 2024

The animetosho api is very reliable. In the last 5-6 months it had only like 3-4 days outage . There is another torrent api named torrentio which is more reliable and u can use kitsu and imdb ids for that one . The torrentio api doesn't have a wiki or any web interface , I found it when I was looking into stremio plugin codes and it almost has no downtimes and is very well maintained with anime and non anime all content. It lacks a little bit on the anime side (negligence amount but when finding rare shows it matters). But the overall library size is much much larger than animetosho since it scrapes from
YTS(+), EZTV(+), RARBG(+), 1337x(+), ThePirateBay(+), KickassTorrents(+), TorrentGalaxy(+), MagnetDL(+), HorribleSubs(+), NyaaSi(+), TokyoTosho(+), AniDex(+), Rutor(+), Rutracker(+), Comando(+), BluDV(+), Torrent9(+), ilCorSaRoNeRo(+), MejorTorrent(+), Wolfmax4k(+), Cinecalidad(+). And I "think" the update interval is 3-4 hrs , not sure it may have gotten update .

@P0bo
Copy link
Author

P0bo commented Dec 10, 2024

doesn't have a wiki or any web interface

I remember there is a configuration page for addon but it doesn't have much info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants