A Simple, LightWeight, Statically-Typed Python3 API wrapper for GogoAnime.

Overview

AniKimi API

A Simple, LightWeight, Statically-Typed Python3 API wrapper for GogoAnime
The v2 of gogoanimeapi (depreciated)
Made with JavaScript and Python3

Features of AniKimi

  • Custom url changing option.
  • Statically-Typed, No more annoying JSON responses.
  • Autocomplete supported by most IDE's.
  • Complete solution.
  • Faster response.
  • Less CPU consumption.

Installing

Using Pypi

$ pip3 install anikimiapi

Getting Started

Pre-Requisites

  • Getting Required Tokens

    • Visit the GogoAnime Website.
    • Login or SignUp using ur email or google.
    • Add an extension to your browser named Get cookies.txt.
    • Now in the GogoAnime Website, right click and select "Get cookies.txt"
    • A .txt file will be downloaded.
    • In the .txt file, find the name "gogoanime" and "auth".
    • Copy the respective tokens on the right side of the above names.
    • Keep it safely, since its your private credentials.

Diving into the API

Authorize the API

To Authorize the API, use AniKimi class. You can also import it from other files. It also supports cross imports. But all API request should be made using this class only.

from anikimiapi import AniKimi

# Initialize AniKimi class
anime = AniKimi(
    gogoanime_token="the saved gogoanime token",
    auth_token="the saved auth token",
    host="https://gogoanime.pe/"  
)

Note: If GogoAnime changes their domain, use the 'host' parameter. Otherwise, leave it blank. This parameter was optional and defaults to https://gogoanime.pe/

Getting Anime search results

You can search anime by using search_anime method, It returns the search results as ResultObject which contains two arguments, the title and animeid.

from anikimiapi import AniKimi

anime = AniKimi(
    gogoanime_token="the saved gogoanime token",
    auth_token="the saved auth token"
)

# Search Anime
results = anime.search_anime(query="tokikaku kawaii")

for i in results:
    print(i.title) # (or)
    print(i.animeid)

Note: If no search results found, the API will raise NoSearchResultsError error. Make sure to handle it.

Getting details of a specific Anime

You can the basic information about a specific anime with animeid using get_details method. It will return anime details as MediaInfoObject.

The MediaInfoObject contains the following arguments,

  • title
  • other_names
  • season
  • year
  • status
  • genres
  • episodes
  • image_url
  • summary
from anikimiapi import AniKimi

anime = AniKimi(
    gogoanime_token="the saved gogoanime token",
    auth_token="the saved auth token"
)

# Get anime Details
details = anime.get_details(animeid="clannad-dub")
print(details.title)
print(details.genres) # And many more...

Note: If an Invalid animeid is given, the API will raise InvalidAnimeIdError. Make sure to handle it.

Getting the Anime Links

You can simply get the streamable and downloadable links of a specific episode of an Anime by its animeid and episode_num using get_episode_link method. It will return anime links in MediaLinksObject.

The MediaLinksObject returns the links, if available. Otherwise, it will return None. The MediaLinksObject has the following arguments,

  • link_hdp
  • link_360p
  • link_480p
  • link_720p
  • link_1080p
  • link_streamsb
  • link_xstreamcdn
  • link_streamtape
  • link_mixdrop
  • link_mp4upload
  • link_doodstream
from anikimiapi import AniKimi

anime = AniKimi(
    gogoanime_token="the saved gogoanime token",
    auth_token="the saved auth token"
)

# Getting Anime Links
anime_link = anime.get_episode_link(animeid="clannad-dub", episode_num=3)

print(anime_link.link_hdp)
print(anime_link.link_720p)
print(anime_link.link_streamsb) # And many more...

Note: If invalid animeid or episode_num is passed, the API will return InvalidAnimeIdError. Make sure to handle it.

If the given gogoanime_token and auth_token are invalid, the API will raise InvalidTokenError. So, be careful of that.

Getting a List of anime by Genre

You can also get the List of anime by their genres using get_by_genres method. This method will return results as a List of ResultObject.

Currently, the following genres are supported,

  • action
  • adventure
  • cars
  • comedy
  • dementia
  • demons
  • drama
  • dub
  • ecchi
  • fantasy
  • game
  • harem
  • hentai - Temporarily Unavailable
  • historical
  • horror
  • josei
  • kids
  • magic
  • martial-arts
  • mecha
  • military
  • music
  • mystery
  • parody
  • police
  • psychological
  • romance
  • samurai
  • school
  • sci-fi
  • seinen
  • shoujo
  • shoujo-ai
  • shounen-ai
  • shounen
  • slice-of-life
  • space
  • sports
  • super-power
  • supernatural
  • thriller
  • vampire
  • yaoi
  • yuri
from anikimiapi import AniKimi

anime = AniKimi(
    gogoanime_token="the saved gogoanime token",
    auth_token="the saved auth token"
)

# Getting anime list by genres
gen = anime.get_by_genres(genre_name="romance", page=1)

for result in gen:
    print(result.title)
    print(result.animeid)

Note: If invalid genre_name or page is passed, the API will raise InvalidGenreNameError. Make sure to handle it.

Getting List of Airing Anime (v2 API New Feature)

You can get a List of currently Airing Anime using get_airing_anime method. This method will return results as a List of ResultObject.

from anikimiapi import AniKimi

anime = AniKimi(
    gogoanime_token="the saved gogoanime token",
    auth_token="the saved auth token"
)

# Getting Airing Anime List
airing = anime.get_airing_anime(count=15)
for i in airing:
    print(i.title)
    print(i.animeid)

Note: If the value of count exceeds 20, The API will raise AiringIndexError. So, pass a value less than or equal to 20.

Copyrights ©2021 BaraniARR;

Licensed under GNU GPLv3 Licnense;

Comments
  • [Feature] [TOKEN extraction method] #Add to README.md

    [Feature] [TOKEN extraction method] #Add to README.md

    description

    it's kinda pain to extract the token using pc... Its following methods which i know about token and cookies data extraction

    Methods

    1. Method - using android debug mode Its kinda pain but you can see it how-do-i-extract-and-view-cookies-from-android-chrome

    2. Method - using third party android browser Its easy and convenient even noob in coding can also do it. App in Play store

    3. Method - using eruda Dev consule for all browsers. Its easy You can find repo Here Just copy code ↓

    javascript:(function () { var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init() } })();

    Bookmark it and name it as Inspect element Then you can use it in any browser..

    YOU CAN REFER STACKOVERFLOW for this.

    Keep going on!! I like your work 🍭

    opened by heartlog 2
  • suggestion/enhancement : auth tokens should only be used for returning direct download links

    suggestion/enhancement : auth tokens should only be used for returning direct download links

    the download links except link_hdp,link1080p,link_720p,link_480p,link360p are not direct (i.e, just iframe/embed).

    those links can be just scraped without requiring auth tokens.

    as per my suggestion , only method related to returning these direct download links should require those auth tokens. this will make the library more accessible like the previous version since all other info can be acquired wihout instantiating the class with auth tokens.

    @BaraniARR , this will obviously require changing a bunch of things like creating 2 different download methods and media links objects but would be worth it imo.

    opened by ryan-k8 1
  • Pip import error

    Pip import error

    Importing module failed and given the error : No module named anikimiapi Try to publish an update to pypi

    Or

    have a __init__.py? Check it and try to correct it To make import walk through your directories every directory must have a __init__.py file

    opened by heartlog 1
  • got rid of  page_num param from get_by_genres method

    got rid of page_num param from get_by_genres method

    I implemented this todo from anikimi support (https://github.com/BaraniARR/anikimiapi/projects/2#card-68131537). it is now possible to get your required no of anime based on a genre without meddling with page_num.

    due to this, the updated method now has another param : limit & 2 helper functions inside for better readibility and structure of code (see below)

              def get_by_genres(self,genre_name, limit=60 ) -> list :
                """ limit(``int``):
                    The limit for the number of anime you want from the results. defaults to 60 (i.e, 3 pages)"""
                def page_anime_scraper(soup_object) -> list:
                      """a helper function to scrape anime results from page source"""
                      ...
                def pagination_helper(current_page_source : str,url,limit:int) -> None:
                      """a recursive helper function which helps to successively scrape anime from following pages
                       (if there are any) till limit is reached. """ 
                     ...
    
    
    opened by ryan-k8 0
  • Always getting 'InvalidAnimeIdError' error

    Always getting 'InvalidAnimeIdError' error

    Trying to get a link to any anime, including using the example code, results in an InvalidAnimeIdError. My code is as follows:

    results = anikimi.search_anime(query=search)
            for i in results:
                animeid = i.animeid
            
            
            anime_link = anikimi.get_episode_link_advanced(animeid=animeid, episode_num=1)
    
            await ctx.send(anime_link.link_720p)
            await ctx.send(anime_link.link_1080p)
    

    Error is as follows:

    Command raised an exception: InvalidAnimeIdError: Invalid animeid or episode_num given

    This API looks really easy to use, would love to be able to get it working.

    opened by Nova-69 2
  • fixed error/issue: host giving 403 error code on every request

    fixed error/issue: host giving 403 error code on every request

    context : #11 #12 i have fixed this by adding an attribute user_agent in the constructor of the main class which is passed on as header option for every request made to the host. the main gist of changes ⬇️

    the constructor of the main class

    def __init__(
                self,
                gogoanime_token: str,
                auth_token: str, 
                host: str = "https://gogoanime.pe/",
                user_agent:dict = {'User-Agent': 'Mozilla/5.0'},
        ):
    

    now every get requests made to the host looks something like this

    requests.get(animelink,headers=self.user_agent)
    #or
    session.get(url,headers=self.user_agent) 
    
    opened by ryan-k8 0
  • host gives 403 error code on every requests

    host gives 403 error code on every requests

    as mentioned in #11 , this was simply because the host website has been updated and gives 403 error code if user-agent is not set in request headers. i am making a PR to fix this.

    opened by ryan-k8 0
  • 'NoneType' object has no attribute 'find'

    'NoneType' object has no attribute 'find'

    There seems to be an error in the API

    Traceback (most recent call last): File "/Users/user/Library/Python/3.9/lib/python/site-packages/anikimiapi/anikimi.py", line 218, in get_episode_link_advanced source_url = lnk.find("li").a AttributeError: 'NoneType' object has no attribute 'find'

    opened by tanner02 2
  • get_download_link not working.

    get_download_link not working.

    the get_download_link option is not working.

    everytime when you try to get the download link, it returns the gogo-cdn.com link that shows the "403: Forbidden" error upon entering.

    this error could be on my side, but please see if you can do anything with it. i am using the newest version.

    opened by KrychaTech 1
  • [Enhancement] [Suggestion] Getting the required cookies using simple javascript

    [Enhancement] [Suggestion] Getting the required cookies using simple javascript

    [Just a small friendly enhancement for getting the prerequisites :)]

    After logging in/signing up in the gogoanime's website, the below code can be pasted into the console tab of the developer tools to get the required cookies directly in the hand without needing to install any extension. This can be added in the readme as an alternative method to get cookies. I am a python dev though, It's just a simple thing so I thought it would be better to create an issue for this rather than forking and generating a PR.

    const value = `; ${document.cookie}`;
    const cookies = ['gogoanime', 'auth']
    for (let cookie in cookies){
       const parts = value.split(`; ${cookies[cookie]}=`);
       if (parts.length === 2){console.log(`\"${cookies[cookie]}\": \"${parts.pop().split(';').shift()}\"`);}
    }
    

    Example: image

    opened by FireHead90544 1
Releases(v0.1.4-beta)
Owner
Python programmer since student. Specialist in telegram bots and problem solving.
⚡ ʑɠ ცơɬ Is One Of The Fastest & Smoothest Bot On Telegram Based on Telethon ⚡

『ʑɠ ცơɬ』 ⚡ ʑɠ ცơɬ Is One Of The Fastest & Smoothest Bot On Telegram Based on Telethon ⚡ Status Of Bot Telegram 🏪 Dєρℓογ το нєяοκυ Variables APP_ID =

ʑɑʑɓɦɑɪ 0 Feb 12, 2022
A course on getting started with the Twitter API v2 for academic research

Getting started with the Twitter API v2 for academic research Welcome to this '101 course' on getting started with academic research using the Twitter

@TwitterDev 426 Jan 04, 2023
Watches your earnings on EarnApp and notifies you when you earned balance or received an payout.

EarnApp-Earning-Monitor Watches your earnings on EarnApp and notifies you when you earned balance or received an payout. Installation Install Python3

Yariya 21 Oct 17, 2022
Send Informative, Concise Slack Notifications With Minimal Effort

slack-templates Send Informative, Concise Slack Notifications With Minimal Effort slack-templates Slack Integration Available Templates Usage Report t

9 Nov 03, 2022
A clean, easy to scale discord bot template

A clean, easy to scale discord bot template. Develope using nextcord library and can be use with any other discord.py forked library.

めがねこ 3 Mar 03, 2022
A collection of tools for managing Jira issues for the RHODS project

RHODS-Jira-Tools A collection of tools for managing Jira issues for the RHODS project move_to_qa.py This script handles transitioning a given Jira iss

Alex Corvin 1 Sep 20, 2022
Definitive Guide to Creating a SQL Database on Cloud with AWS and Python

Definitive Guide to Creating a SQL Database on Cloud with AWS and Python An easy-to-follow comprehensive guide on integrating Amazon RDS, MySQL Workbe

Kenneth Leung 6 Aug 17, 2022
This Wrapper is a Discum Copy With Addons, original one is made by Merubokkusu

Remaded Discum Its not Official Discum Wrapper ! This Wrapper is a Discum Copy With Addons, original one is made by Merubokkusu Authors @merubokkusu (

discum-remaded 8 Aug 09, 2022
Python + AWS Lambda Hands OnPython + AWS Lambda Hands On

Python + AWS Lambda Hands On Python Criada em 1990, por Guido Van Rossum. "Bala de prata" (quase). Muito utilizado em: Automatizações - Selenium, Beau

Marcelo Ortiz de Santana 8 Sep 09, 2022
A simple discord tool that translates english to either spanish, german or french and sends it. Free to rework but please give me credit.

discord-translator A simple discord tool that translates english to either spanish, german or french and sends it. Free to rework but please give me c

TrolledTooHard 2 Oct 04, 2021
Video Stream: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music

SHU KURENAI TEAM 4 Nov 05, 2022
OpenSource bot for control groups ...

⭕️ کمک به افراد برای اداره هرچه فان تره گروه 📟 همه گروه های بزرگ نیاز به یه بات خفن دارن تا از گروه مراقبت کنه این بات کارش همینه سعی کرده فیچر خیلی

Mehran Alam Beigi 2 Nov 26, 2021
A client library for the REST API of DocuWare's DMS

docuware-client This is a client library for the REST API of DocuWare DMS. Since DocuWare's documentation regarding the REST API is very sparse (at th

Stefan Schönberger 1 Feb 23, 2022
An unofficial library for discord components (under-development)

discord-components An unofficial library for discord components (under-development) Welcome! Discord components are cool, but discord.py will support

11 Jun 14, 2021
Automated endpoint management for Amazon Aurora Global Database

This sample code can be used to manage Aurora global database endpoints. After failover the global database writer endpoints swap from one region to the other. This solution automates creation and ma

AWS Samples 13 Dec 08, 2022
The official Discord Python framework for thenewboston blockchain.

Project Setup Follow the steps below to set up the project on your environment. Mac Setup Homebrew requires the Xcode command-line tools from Apple's

Bucky Roberts 18 Jul 15, 2022
A telegram bot writen in python for mirroring files on the internet to our beloved Google Drive

[] Mirror Bot This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive. Deploying on Heroku Give Star &

43 Mar 06, 2022
A high level library for building Discord bots.

Qord A high level library for building Discord bots. 🚧 This library is currently in development. Questions that you are having What is this? This is

Izhar Ahmad 16 May 14, 2022
This bot will delete messages containing blacklisted words in your telegram groups.

Profanity Detector Bot This bot will delete messages containing blacklisted words in your telegram groups. Made using ProfanityDetector.

Aditya 17 Oct 08, 2022