Project Icon

aniwatch-api

开源动漫数据接口服务

aniwatch-api是一个基于hianime.to数据的开源动漫信息接口。该接口支持获取动漫首页、搜索结果、详情和剧集等多种功能,提供丰富的动漫数据如推荐列表和相关动漫。开发者可以方便地使用这个接口构建动漫应用,满足各类动漫信息需求。

Logo

Aniwatch API

A free restful API serving anime information from hianime.to

Bug report · Feature request

codeql docker-build test_coverage GitHub License

stars forks issues version

[!IMPORTANT]

  1. https://api-aniwatch.onrender.com is only meant to demo the API and has rate-limiting enabled to minimise bandwidth consumption. It is recommended to deploy your own instance for personal use by customizing the api as you need it to be.
  2. This API is just an unofficial api for hianime.to and is in no other way officially related to the same.
  3. The content that this api provides is not mine, nor is it hosted by me. These belong to their respective owners. This api just demonstrates how to build an api that scrapes websites and uses their content.

Table of Contents

💻 Installation

Local

  1. Clone the repository and move into the directory.

    git clone https://github.com/ghoshRitesh12/aniwatch-api.git
    cd aniwatch-api
    
  2. Install all the dependencies.

    npm i #or yarn install or pnpm i
    
  3. Start the server!

    npm start #or yarn start or pnpm start
    

    Now the server should be running on http://localhost:4000

Docker

Docker image is available at GitHub Container Registry.

Run the following commands to pull and run the docker image.

docker pull ghcr.io/ghoshritesh12/aniwatch
docker run -p 4000:4000 ghcr.io/ghoshritesh12/aniwatch

The above command will start the server on port 4000. You can access the server at http://localhost:4000 and you can also change the port by changing the -p option to -p <port>:4000.

You can also add the -d flag to run the container in detached mode.

⛅ Host your instance

[!CAUTION]

For personal deployments, refrain from having an env named ANIWATCH_API_HOSTNAME. You may face rate limitting and other issues if you do.

Vercel

Deploy your own instance of Aniwatch API on Vercel.

Deploy with Vercel

[!NOTE]

When deploying to vercel, set an env named IS_VERCEL_DEPLOYMENT to true or anything, but this env should be present.

Render

Deploy your own instance of Aniwatch API on Render.

Deploy to Render

📚 Documentation

The endpoints exposed by the api are listed below with examples that uses the Fetch API, but you can use any http library.

GET Anime Home Page

Endpoint

https://api-aniwatch.onrender.com/anime/home

Request sample

const resp = await fetch("https://api-aniwatch.onrender.com/anime/home");
const data = await resp.json();
console.log(data);

Response Schema

{
  genres: ["Action", "Cars", "Adventure", ...],
  latestEpisodeAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      type: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  spotlightAnimes: [
    {
      id: string,
      name: string,
      jname: string,
      poster: string,
      description: string,
      rank: number,
      otherInfo: string[],
      episodes: {
        sub: number,
        dub: number,
      },
    },
    {...},
  ],
  top10Animes: {
    today: [
      {
        episodes: {
          sub: number,
          dub: number,
        },
        id: string,
        name: string,
        poster: string,
        rank: number
      },
      {...},
    ],
    month: [...],
    week: [...]
  },
  topAiringAnimes: [
    {
      id: string,
      name: string,
      jname: string,
      poster: string,
    },
    {...},
  ],
  topUpcomingAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  trendingAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      rank: number,
    },
    {...},
  ],
  mostPopularAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      type: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  mostFavoriteAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      type: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  latestCompletedAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      type: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
}

🔼 Back to Top

GET Anime About Info

Endpoint

https://api-aniwatch.onrender.com/anime/info?id={anime-id}

Query Parameters

ParameterTypeDescriptionRequired?Default
idstringThe unique anime id (in kebab case).Yes--

Request sample

const resp = await fetch(
  "https://api-aniwatch.onrender.com/anime/info?id=attack-on-titan-112"
);
const data = await resp.json();
console.log(data);

Response Schema

{
  anime: [
    info: {
      id: string,
      name: string,
      poster: string,
      description: string,
      stats: {
        rating: string,
        quality: string,
        episodes: {
          sub: number,
          dub: number
        },
        type: string,
        duration: string
      },
      promotionalVideos: [
        {
          title: string | undefined,
          source: string | undefined,
          thumbnail: string | undefined
        },
        {...},
      ],
      characterVoiceActor: [
        {
          character: {
            id: string,
            poster: string,
            name: string,
            cast: string
          },
          voiceActor: {
            id: string,
            poster: string,
            name: string,
            cast: string
          }
        },
        {...},
      ]
    }
    moreInfo: {
      aired: string,
      genres: ["Action", "Mystery", ...],
      status: string,
      studios: string,
      duration: string
      ...
    }
  ],
  mostPopularAnimes: [
    {
      episodes: {
        sub: number,
        dub: number,
      },
      id: string,
      jname: string,
      name: string,
      poster: string,
      type: string
    },
    {...},
  ],
  recommendedAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  relatedAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  seasons: [
    {
      id: string,
      name: string,
      title: string,
      poster: string,
      isCurrent: boolean
    },
    {...}
  ]
}

🔼 Back to Top

GET Search Results

Endpoint

# basic example
https://api-aniwatch.onrender.com/anime/search?q={query}&page={page}

# advanced example
https://api-aniwatch.onrender.com/anime/search?q={query}&genres={genres}&type={type}&sort={sort}&season={season}&language={sub_or_dub}&status={status}&rated={rating}&start_date={yyyy-mm-dd}&end_date={yyyy-mm-dd}&score={score}

Query Parameters

ParameterTypeDescriptionRequired?Default
qstringThe search query, i.e. the title of the item you are looking for.Yes--
pagenumberThe page number of the result.No1
typestringType of the anime. eg: movieNo--
statusstringStatus of the anime. eg: finished-airingNo--
ratedstringRating of the anime. eg: r+ or pg-13No--
scorestringScore of the anime. eg: good or very-goodNo--
seasonstringSeason of the aired anime. eg: springNo--
languagestringLanguage category of the anime. eg: sub or sub-&-dubNo--
start_datestringStart date of the anime(yyyy-mm-dd). eg: 2014-10-2No--
end_datestringEnd date of the anime(yyyy-mm-dd). eg: 2010-12-4No--
sortstringOrder of sorting the anime result. eg: recently-addedNo--
genresstringGenre of the anime, separated by commas. eg: isekai,shounenNo--

[!TIP] For both start_date and end_date, year must be mentioned. If you wanna omit date or month specify 0 instead. Eg: omitting date -> 2014-10-0, omitting month -> 2014-0-12, omitting both -> 2014-0-0

Request sample

// basic example
const resp = await fetch(
  "https://api-aniwatch.onrender.com/anime/search?q=titan&page=1"
);
const data = await resp.json();
console.log(data);

// advanced example
const resp = await fetch(
  "https://api-aniwatch.onrender.com/anime/search?q=girls&genres=action,adventure&type=movie&sort=score&season=spring&language=dub&status=finished-airing&rated=pg-13&start_date=2014-0-0&score=good"
);
const data = await resp.json();
console.log(data);

Response Schema

{
  animes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  mostPopularAnimes: [
    {
      episodes: {
        sub: number,
        dub: number,
      },
      id: string,
      jname: string,
      name: string,
      poster: string,
      type: string
    },
    {...},
  ],
  currentPage: 1,
  totalPages: 1,
  hasNextPage: false,
  searchQuery: string,
  searchFilters: {
    [filter_name]: [filter_value]
    ...
  }
}

🔼 Back to Top

GET Search Suggestions

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

白日梦AI

白日梦AI提供专注于AI视频生成的多样化功能,包括文生视频、动态画面和形象生成等,帮助用户快速上手,创造专业级内容。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

讯飞绘镜

讯飞绘镜是一个支持从创意到完整视频创作的智能平台,用户可以快速生成视频素材并创作独特的音乐视频和故事。平台提供多样化的主题和精选作品,帮助用户探索创意灵感。

Project Cover

讯飞文书

讯飞文书依托讯飞星火大模型,为文书写作者提供从素材筹备到稿件撰写及审稿的全程支持。通过录音智记和以稿写稿等功能,满足事务性工作的高频需求,帮助撰稿人节省精力,提高效率,优化工作与生活。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号