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.
A visualization of people a user follows on Twitter

Twitter-Map This software allows the user to create maps of Twitter accounts. Installation git clone Oliver Greenwood 12 Jul 20, 2022

python script to buy token from pancakeswap

pancakeswapBot python script to buy token from pancakeswap Change your privatekey!!! on line 58 (signed_txn = web3.eth.account.sign_transaction(pancak

206 Dec 31, 2022
微信支付接口V3版python库

wechatpayv3 介绍 微信支付接口V3版python库。 适用对象 wechatpayv3支持微信支付直连商户,接口说明详见 官网。 特性 平台证书自动更新,无需开发者关注平台证书有效性,无需手动下载更新; 支持本地缓存平台证书,初始化时指定平台证书保存目录即可。 适配进度 微信支付V3版A

chen gang 258 Jan 06, 2023
Creating a Python API, for the MakeMyTrip Flight Schedules.

MakeMyTripAPI Creating a Python API, for the MakeMyTrip Flight Schedules. Source: MakeMyTrip is an Indian online travel company founded in 2000. Headq

Aman Priyanshu 0 Jan 12, 2022
An unoffcial python API client for primeuploads.com

primeuploads-py An unoffcial python API wrapper for primeuploads.com Installation pip3 install primeuploads-py Usage example from prime import PrimeUp

W4RR10R 41 Dec 05, 2022
A template / demo bot for the Halcyon matrix bot library

Halcyon stock bot Hello! This is an example / template bot using the halcyon matrix bot library. Feel free to ask questions in the matrix chat #halcyo

Wes Ring 1 Feb 04, 2022
TrollWare 🤡 is the most advanced Discord Malware & RAT

TrollWare 🤡 TrollWare is the most advanced Discord Malware, with a built-in RAT which can be controlled through a Discord Bot Pinned Note: Please giv

doop 74 Jun 09, 2022
Simple Telegram AI Chat bot made using OpenAI and Luna API

Yui Yui, is a simple telegram chat bot made using OpenAI and Luna Chat bot Deployment 👀 Deploying is easy 🤫 ! You can deploy this bot in Heroku or i

I'm Not A Bot #Left_TG 21 Dec 29, 2022
This repository contains modules that extend / modify parts of Odoo ERP

Odoo Custom Addons This repository contains addons that extend / modify parts of Odoo ERP. Addons list account_cancel_permission Only shows the button

Daniel Luque 3 Dec 28, 2022
Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation

secp256k1 Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation Example Usage import secp256k1 as ice print('[C]',privatekey_to_addres

iceland 49 Jan 01, 2023
Get some python in google cloud functions

[NOTE]: This is a highly experimental (and proof of concept) library so do not expect all python packages to work flawlessly. Also, cloud functions ar

Martin Abelson Sahlen 200 Nov 24, 2022
Criando Lambda Functions para Ingerir Dados de APIs com AWS CDK

LIVE001 - AWS Lambda para Ingerir Dados de APIs Fazer o deploy de uma função lambda com infraestrutura como código Lambda vai numa API externa e extra

Andre Sionek 12 Nov 20, 2022
OpenVisionAPI client

OpenVisionAPI Client 🚀 Getting Started Prerequisites Installing Install the dependencies $ make setup Usage $ source .venv/bin/activate $ ./ova_clie

Open Vision API 40 Nov 11, 2022
PackMyPayload - Emerging Threat of Containerized Malware

This tool takes a file or directory on input and embeds them into an output file acting as an archive/container.

Mariusz Banach 594 Dec 29, 2022
The best Fortnite all-in-one lobby bot!

Recommended to use on Python v3.8 stable for bot. FLB The best free Fortnite lobby bot experience! Discord server: PDennSploit Softworks LLC Getting S

Payson Holmes 2 May 11, 2022
A smooth and powerful Telegram Userbot made to make Telegram easier.

| Xᴇɴᴏ Bᴏᴛ Is One Of The Fastest & Smoothest Bot On Telegram Based on Telethon|

SimpleBoy 1 Dec 01, 2021
Rhythm bot clone for discord written in Python and uses YouTube to get media files.

Tunebot About Rhythm bot clone for discord written in Python and uses YouTube to get media files. Usage You need a .env file within the same directory

1 Oct 21, 2021
NiceHash Python Library and Command Line Rest API

NiceHash Python Library and Command Line Rest API Requirements / Modules pip install requests Required data and where to get it Following data is nee

Ashlin Darius Govindasamy 2 Jan 02, 2022
Transcript-Extractor-Bot - Yet another Telegram Voice Recognition bot but using vosk and supports 20+ languages

transcript extractor Yet another Telegram Voice Recognition bot but using vosk a

6 Oct 21, 2022