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.
Data portal client and server for NMDC.

NMDC Server and Client Portal Getting started with Docker install ldc install submodules via git submodule update --init --recursive In order to popul

National Microbiome Data Collaborative 7 Dec 14, 2022
Twitter bot to know the number of dislikes of a YouTube video

YT_dislikes is a twitter bot that allows you to know the number of dislikes (and likes) of a YouTube video. Now it is not possible to see the number o

1 Jan 08, 2022
Install and manage Proton-GE and Luxtorpeda for Steam and Wine-GE for Lutris with this graphical user interface. Based on AUNaseef's ProtonUp, made with Python 3 and Qt 6.

ProtonUp-Qt Qt-based graphical user interface to install and manage Proton-GE installations for Steam and Wine-GE installations for Lutris. Based on A

638 Jan 02, 2023
Convenient script for trading with python.

Convenient script for trading with python.

VladKochetov007 66 Dec 07, 2022
M3U Playlist for free TV channels

Free TV This is an M3U playlist for free TV channels around the World. Either free locally (over the air): Or free on the Internet: Plex TV Pluto TV P

Free TV 964 Jan 08, 2023
A simple API wrapper for Discord written in Python.

AIOCord This project is work in progress not for production use A simple asynchronous API wrapper around Discord API written in Python. Inspiration Th

Izhar Ahmad 3 Dec 07, 2021
Unofficial Discord Rich Presence for HackTheBox platform

HTBRichPresence Unofficial Discord Rich Presence for HackTheBox platform The project is under lazy development. How to run Install requirements: // I'

Antonio 4 Apr 19, 2022
itadori webhook spammer fucker

itadori-webhook-spammer-fucker Installation # install the requirements $ python3 -m pip install -r requirements.txt $ python3 main.py Repl.it: https:/

6 Mar 05, 2022
Instagram GiftShop Scam Killer

Instagram GiftShop Scam Killer A basic tool for Windows which kills acess to any giftshop scam from Instagram. Protect your Instagram account from the

1 Mar 31, 2022
A Discord/Xenforo bot!

telathbot A Discord/Xenforo bot! Pre-requisites pyenv (via installer) poetry Docker (with Go version of docker compose enabled) Local development Crea

Telath 4 Mar 09, 2022
The best (and now open source) Discord selfbot.

React Selfbot Yes, for real Why am I making this open source? Because can't stop calling my product a rat, tokenlogger and what else not. But there is

30 Nov 13, 2022
Fix Twitter video embeds in Discord

TwitFix very basic flask server that fixes twitter embeds in discord by using youtube-dl to grab the direct link to the MP4 file and embeds the link t

Robin Universe 682 Dec 28, 2022
Actively maintained, pure Python wrapper for the Twitter API. Supports both normal and streaming Twitter APIs.

Twython Twython is a Python library providing an easy way to access Twitter data. Supports Python 3. It's been battle tested by companies, educational

Ryan McGrath 1.9k Jan 02, 2023
Cdk-python-crud-app - CDK Python CRUD App

Welcome to your CDK Python project! You should explore the contents of this proj

Shapon Sheikh 1 Jan 12, 2022
A code that can make your 5 accounts stay 24/7 in a discord voice channel!

Voicecord A code that can make your 5 accounts stay 24/7 in a discord voice channel! Usage ・Fork the repo ・Clone it to replit ・Install the required pa

DraKenCodeZ 3 Jan 09, 2022
Automatically pulls specified repository whenever a specified file is pushed. Great for working collaboratively when you need to run something locally.

autopull Simple python tool that allows you to automatically pull from a github repository whenever a file with a specified name is uploaded installat

carreb 0 Sep 27, 2022
Experimental bridges between Telegram calls and other platforms.

Bridges by Calls Music Experimental bridges between Telegram calls and other platforms. Current bridges Bridge 1 (YouTube, Twitch, Facebook, etc...) B

Calls Music 14 Oct 08, 2022
Lending-Club-Loans - Using TensorFlow to create an ANN model to predict whether people would charge off or pay back their loans.

Lending Club Loans: Brief Introduction LendingClub is a US peer-to-peer lending company, headquartered in San Francisco, California.[3] It was the fir

Ali Akram 1 Jan 03, 2022
A custom rom post bot for Telegram.

Rom Poster Bot A simple Post Bot written in Python using pyTelegramBotAPI to post rom updates to telegram whenever you need. Made by lazy peep for laz

Prajwal 6 Nov 03, 2022
Spore REST API asyncio client

Spore REST API asyncio client

LEv145 16 Aug 02, 2022