### Get Random Anime from Anilist (Python) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-random-anime Fetches a random anime from the Anilist provider using Python. This example demonstrates how to make an HTTP GET request to the API. It is assumed that a library like 'requests' would be used for making HTTP requests in a real-world scenario, though not explicitly shown here. ```python # Python example for fetching random anime from Anilist # Note: Actual implementation would require an HTTP client library like 'requests' # url = "https://api.consumet.org/meta/anilist/random-anime" # response = requests.get(url) # data = response.json() # print(data) ``` -------------------------------- ### Search SFlix Provider (JavaScript) Source: https://docs.consumet.org/rest-api/Movies/sflix/search Example code for searching the SFlix provider using JavaScript and the axios library. It demonstrates how to construct the API URL and handle the response. This function requires the axios package to be installed. ```javascript import axios from "axios"; // Using the example query "breaking bad" const url = "https://api.consumet.org/movies/sflix/breaking bad"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Search SFlix Provider (Python) Source: https://docs.consumet.org/rest-api/Movies/sflix/search Example code for searching the SFlix provider using Python and the requests library. It shows how to build the request URL and process the JSON response. Ensure the 'requests' library is installed. ```python import requests # Using the example query "breaking bad" url = "https://api.consumet.org/movies/sflix/breaking bad" def get_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(str(e)) print(get_data()) ``` -------------------------------- ### Get Light Novel Info - Python Source: https://docs.consumet.org/rest-api/Light-Novels/read-light-novels/get-light-novel-info Fetches detailed information for a light novel using its ID and an optional chapter page number. This Python example demonstrates how to make an HTTP GET request to the Consumet API. ```python import requests url = "https://api.consumet.org/light-novels/readlightnovels/info" params = { "id": "solo-leveling-1597", "chapterPage": 1 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Get Light Novel Chapter - Python Source: https://docs.consumet.org/rest-api/Light-Novels/read-light-novels/get-light-novel-chapter Retrieves light novel chapter content via the Consumet API using Python. This example utilizes the 'axios' library (though typically 'requests' would be used in Python, this mirrors the JS example's structure for demonstration). It requires a chapterId and returns chapter details. ```python import axios const url = "https://api.consumet.org/light-novels/readlightnovels/read"; const data = async () => { try { const { data } = await axios.get(url, { params: { chapterId: "solo-leveling-chapter-1" } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Proxy Manga Image with JavaScript and Python Source: https://docs.consumet.org/rest-api/Manga/mangapill/proxy Code examples for proxying manga images using JavaScript and Python. These examples demonstrate how to make a GET request to the image proxy endpoint to bypass CORS restrictions and hotlink protection. The response contains the proxied image binary data. ```javascript import axios from "axios"; // Using an example image URL (URL encoded). const imageUrl = encodeURIComponent("https://mangapill.com/images/manga/12345/001.jpg"); const url = `https://api.consumet.org/manga/mangapill/proxy?url=${imageUrl}`; const data = async () => { try { const response = await axios.get(url, { responseType: 'arraybuffer' }); return response.data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests import urllib.parse # Using an example image URL (URL encoded). image_url = "https://mangapill.com/images/manga/12345/001.jpg" encoded_url = urllib.parse.quote(image_url) url = f"https://api.consumet.org/manga/mangapill/proxy?url={encoded_url}" try: response = requests.get(url, stream=True) response.raise_for_status() # Raise an exception for bad status codes # Process the image data (e.g., save to a file) with open("proxied_image.jpg", "wb") as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk) print("Image proxied successfully.") except requests.exceptions.RequestException as e: print(f"Error proxying image: {e}") ``` -------------------------------- ### Get Genres from HiAnime (Python) Source: https://docs.consumet.org/rest-api/Anime/hianime/genres Retrieves genres from the HiAnime provider via the Consumet API. This Python example demonstrates making a GET request to the API endpoint using the 'requests' library. Error handling is included for robustness. ```python import requests url = "https://api.consumet.org/anime/hianime/genres" try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") ``` -------------------------------- ### Get AnimeUnity Anime Info (Python) Source: https://docs.consumet.org/rest-api/Anime/animeunity/get-anime-info Fetches detailed information for an anime from AnimeUnity using its ID. This Python example utilizes the 'requests' library to make the GET request. It returns a dictionary with anime data or raises an exception on failure. ```python import requests # Using the example ID of "7221-demon-slayer-kimetsu-no-yaiba". url = "https://api.consumet.org/anime/animeunity/info/7221-demon-slayer-kimetsu-no-yaiba" def get_anime_info(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(str(e)) print(get_anime_info()) ``` -------------------------------- ### Get Anilist Anime Info (Python) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-anime-info Fetches anime details from Anilist via the Consumet API using Python. This example utilizes the 'requests' library to make a GET request to the API endpoint. It requires an anime ID and can optionally specify a provider, returning structured JSON data. ```python import requests # Using the example id of "21" (one piece) and the query of "gogoanime" url = "https://api.consumet.org/meta/anilist/info/21" def get_anime_info(): try: response = requests.get(url, params={'provider': 'gogoanime'}) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching anime info: {e}") anime_data = get_anime_info() print(anime_data) ``` -------------------------------- ### Fetch Trending Anime (Python) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-trending-anime Fetches a paginated list of trending anime from the Anilist provider using the Consumet API. This example uses the 'requests' library for making HTTP GET requests. It shows how to include 'page' and 'perPage' as query parameters. ```python import requests url = "https://api.consumet.org/meta/anilist/trending" params = { "page": 1, "perPage": 20 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error fetching data: {e}") ``` -------------------------------- ### Fetch Popular Anime (Python) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-popular-anime Fetches a list of popular anime from the Anilist provider using the Consumet API. This example uses the 'requests' library to make a GET request to the popular anime endpoint with specified pagination parameters. It handles potential errors during the request. ```python import requests # Using the example query "demon", and looking at the first page of results. url = "https://api.consumet.org/meta/anilist/popular" params = { "page": 1, "perPage": 20 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Get Anilist Anime Data by ID (Python) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-anilist-data Retrieves meta data for a specific anime from Anilist using its ID. This Python example uses the 'requests' library to make a GET request to the Consumet API. It includes basic error handling for the request. ```python import requests # Using the example id of "21" (one piece) url = "https://api.consumet.org/meta/anilist/data/21" def get_anilist_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching data: {e}") return None print(get_anilist_data()) ``` -------------------------------- ### Fetch Popular Anime (JavaScript) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-popular-anime Fetches a list of popular anime from the Anilist provider using the Consumet API. This example uses the 'axios' library to make a GET request to the popular anime endpoint with specified pagination parameters. It handles potential errors during the request. ```javascript import axios from "axios"; // Using the example query "demon", and looking at the first page of results. const url = "https://api.consumet.org/meta/anilist/popular"; const data = async () => { try { const { data } = await axios.get(url, { params: { page: 1, perPage: 20 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Search Goku Provider API (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Movies/goku/search Demonstrates how to search for movies using the Goku provider in the Consumet API. It includes examples for making GET requests with specified query parameters and handling responses. The code utilizes 'axios' for JavaScript and standard library for Python. ```javascript import axios from "axios"; // Using the example query "avengers", and looking at the 2nd page of results. const url = "https://api.consumet.org/movies/goku/avengers"; const data = async () => { try { const { data } = await axios.get(url, { params: { page: 2 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "avengers", and looking at the 2nd page of results. url = "https://api.consumet.org/movies/goku/avengers" params = { "page": 2 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Search AnimeSaturn Provider (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Anime/animesaturn/search Provides examples for searching the AnimeSaturn provider using the Consumet API. It demonstrates how to construct the URL and make a GET request. The response is a JSON object containing search results or an error. ```javascript import axios from "axios"; // Using the example query "naruto". const url = "https://api.consumet.org/anime/animesaturn/naruto"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "naruto". url = "https://api.consumet.org/anime/animesaturn/naruto" def get_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(str(e)) print(get_data()) ``` -------------------------------- ### Search Manga on ComicK (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Manga/comick/search Examples of how to search for manga on ComicK using the Consumet API. These snippets demonstrate making a GET request to the search endpoint and handling the response. They require the 'axios' library in JavaScript. ```javascript import axios from "axios"; // Using the example query "solo leveling". const url = "https://api.consumet.org/manga/comick/solo leveling"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "solo leveling". url = "https://api.consumet.org/manga/comick/solo leveling" def get_manga_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error: {e}") return None print(get_manga_data()) ``` -------------------------------- ### Fetch Trending Anime (JavaScript) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-trending-anime Fetches a paginated list of trending anime from the Anilist provider using the Consumet API. This example utilizes the 'axios' library for making HTTP GET requests. It demonstrates how to specify page and perPage query parameters. ```javascript import axios from "axios"; // Using the example query "demon", and looking at the first page of results. const url = "https://api.consumet.org/meta/anilist/trending"; const data = async () => { try { const { data } = await axios.get(url, { params: { page: 1, perPage: 20 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Get Anilist Anime Episode Servers (Python) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-episode-servers Fetches episode server information for an Anilist anime ID via the Consumet API. This Python example uses the 'requests' library to make a GET request. It returns a dictionary containing server details, or raises an error if the request fails. ```python import requests # Using the example id of "21" (one piece) url = "https://api.consumet.org/meta/anilist/servers/21" def get_episode_servers(provider="zoro"): try: response = requests.get(url, params={'provider': provider}) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching episode servers: {e}") print(get_episode_servers()) ``` -------------------------------- ### Search Libgen Books with Python Source: https://docs.consumet.org/rest-api/Books/libgen/search Provides an example of how to search for books using the libgen provider in Python. It uses the requests library to send a GET request to the Consumet API, including the 'bookTitle' and 'page' as query parameters. The function returns the JSON response or handles potential errors. ```python import requests def search_libgen_books(book_title, page=1): """Searches for books using the libgen provider. Args: book_title (str): The title of the book to search for. page (int, optional): The page number of results to return. Defaults to 1. Returns: dict: A dictionary containing the search results. Raises: requests.exceptions.RequestException: If the API request fails. """ url = "https://api.consumet.org/books/libgen/s" params = { "bookTitle": book_title, "page": page } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error searching for books: {e}") raise # Example usage: # try: # results = search_libgen_books("harry potter", page=1) # print(results) # except requests.exceptions.RequestException: # pass ``` -------------------------------- ### Search Manga on Mangadex (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Manga/mangadex/search Example code for searching manga on Mangadex using the Consumet API. This snippet demonstrates how to make a GET request to the API endpoint and handle the response. It requires the 'axios' library for JavaScript. ```javascript import axios from "axios"; // Using the example query "demon". const url = "https://api.consumet.org/manga/mangadex/demon"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "demon". url = "https://api.consumet.org/manga/mangadex/demon" def get_manga_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching data: {e}") print(get_manga_data()) ``` -------------------------------- ### Search Animekai Provider (Python) Source: https://docs.consumet.org/rest-api/Anime/animekai/search Provides an example of how to search for anime using the animekai provider in Python. It uses the `requests` library to send a GET request to the Consumet API. Error handling is included to manage potential issues during the request. ```python import requests # Using the example query "naruto". url = "https://api.consumet.org/anime/animekai/naruto" params = { "page": 1 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Fetch HiAnime Schedule (Python) Source: https://docs.consumet.org/rest-api/Anime/hianime/schedule Fetches the scheduled anime for a specific date from the HiAnime provider using the Consumet API. This example uses the 'requests' library to make an HTTP GET request. It returns the schedule data or raises an exception on failure. ```python import requests url = "https://api.consumet.org/anime/hianime/schedule" params = {"date": "2024-01-15"} try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") ``` -------------------------------- ### Fetch Recently Added Anime (HiAnime) - JavaScript & Python Source: https://docs.consumet.org/rest-api/Anime/hianime/recently-added Demonstrates how to fetch a list of recently added anime from the HiAnime provider using both JavaScript and Python. It utilizes the 'recently-added' endpoint and expects a JSON response containing pagination information and anime details. Ensure you have the 'axios' library installed for the JavaScript example. ```javascript import axios from "axios"; const url = "https://api.consumet.org/anime/hianime/recently-added"; const data = async () => { try { const { data } = await axios.get(url, { params: { page: 1 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests url = "https://api.consumet.org/anime/hianime/recently-added" def get_recently_added(page=1): try: response = requests.get(url, params={'page': page}) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching data: {e}") # Example usage: # print(get_recently_added()) ``` -------------------------------- ### Install Consumet Node Library using npm Source: https://docs.consumet.org/node-library/start Installs the @consumet/extensions library using npm. This is the primary method for adding the library to your Node.js project. ```bash npm i @consumet/extensions ``` -------------------------------- ### Search Light Novels using Consumet API Source: https://docs.consumet.org/rest-api/Light-Novels/read-light-novels/search Demonstrates how to search for light novels via the Consumet API. It includes examples for JavaScript and Python, showing how to construct the URL and handle the response. The API requires a search query as a path parameter. ```javascript import axios from "axios"; // Using the example query "solo leveling". const url = "https://api.consumet.org/light-novels/readlightnovels/solo%20leveling"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "solo leveling". query = "solo leveling" url = f"https://api.consumet.org/light-novels/readlightnovels/{query.replace(' ', '%20')}" def get_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(e) print(get_data()) ``` -------------------------------- ### Install Consumet Node Library using yarn Source: https://docs.consumet.org/node-library/start Installs the @consumet/extensions library using yarn. This is an alternative method for adding the library to your Node.js project if you use yarn. ```bash yarn add @consumet/extensions ``` -------------------------------- ### Get Recent TV Shows (Goku Provider) - Python Source: https://docs.consumet.org/rest-api/Movies/goku/recent-tv-shows Retrieves recent TV shows from the Goku provider via the Consumet API. This Python example demonstrates how to make a GET request to the API endpoint and handle the JSON response. It assumes the 'requests' library is installed. ```python import requests url = "https://api.consumet.org/movies/goku/recent-tv-shows" try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error fetching data: {e}") ``` -------------------------------- ### Get SFlix Media Info using JavaScript and Python Source: https://docs.consumet.org/rest-api/Movies/sflix/get-media-info Demonstrates how to fetch media information from the SFlix provider via the Consumet API. Requires the 'axios' library for JavaScript. Takes a media ID as input and returns detailed media information. ```javascript import axios from "axios"; // Using the example id "tv/watch-breaking-bad-39441" const url = "https://api.consumet.org/movies/sflix/info"; const data = async () => { try { const { data } = await axios.get(url, { params: { id: "tv/watch-breaking-bad-39441" } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example id "tv/watch-breaking-bad-39441" url = "https://api.consumet.org/movies/sflix/info" params = { "id": "tv/watch-breaking-bad-39441" } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Get Genres from HiAnime (JavaScript) Source: https://docs.consumet.org/rest-api/Anime/hianime/genres Fetches a list of genres from the HiAnime provider using the Consumet API. This JavaScript example uses the 'axios' library to make a GET request to the specified URL. It handles potential errors during the request. ```javascript import axios from "axios"; const url = "https://api.consumet.org/anime/hianime/genres"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Search HiAnime by Studio (JavaScript, Python) Source: https://docs.consumet.org/rest-api/Anime/hianime/studio Provides example code for searching anime by studio on HiAnime using the Consumet API. It demonstrates how to make a GET request to the API endpoint and handle the response. Dependencies include 'axios' for JavaScript. The function takes a studio name and an optional page number as input, returning a JSON object with anime results. ```javascript import axios from "axios"; // Using the example studio "mappa". const url = "https://api.consumet.org/anime/hianime/studio/mappa"; const data = async () => { try { const { data } = await axios.get(url, { params: { page: 1 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example studio "mappa". url = "https://api.consumet.org/anime/hianime/studio/mappa" def get_studio_anime(page=1): try: response = requests.get(url, params={'page': page}) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching data: {e}") print(get_studio_anime()) ``` -------------------------------- ### Search TMDB Provider using JavaScript and Python Source: https://docs.consumet.org/rest-api/Meta/the-movie-database/search Demonstrates how to search for content on The Movie Database (TMDB) using the Consumet API. This snippet includes examples for both JavaScript and Python, showing how to construct the request URL and handle the response. It requires the 'axios' library for JavaScript. ```javascript import axios from "axios"; // Using the example query "flash", and looking at the first page of results. const url = "https://api.consumet.org/meta/tmdb/flash"; const data = async () => { try { const { data } = await axios.get(url, { params: { page: 1 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "flash", and looking at the first page of results. url = "https://api.consumet.org/meta/tmdb/flash" params = { "page": 1 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Search Comics using GetComics API (JavaScript, Python) Source: https://docs.consumet.org/rest-api/Comics/getcomics/search Provides examples for searching comics using the GetComics provider. It demonstrates how to construct the request URL and includes sample code for both JavaScript and Python. The response is expected in JSON format. ```javascript import axios from "axios"; // Using the example query "spider man". const url = "https://api.consumet.org/comics/getcomics/s"; const data = async () => { try { const { data } = await axios.get(url, { params: { comicTitle: "spider man", page: 1 } }); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "spider man". url = "https://api.consumet.org/comics/getcomics/s" params = { "comicTitle": "spider man", "page": 1 } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### Get Animekai Schedule (Python) Source: https://docs.consumet.org/rest-api/Anime/animekai/schedule Retrieves the anime schedule for a given date from the Animekai provider via the Consumet API. This example demonstrates how to make an HTTP GET request and handle potential errors. The function is designed to return the schedule data. ```python import requests # Using the example date "monday". url = "https://api.consumet.org/anime/animekai/schedule/monday" def get_schedule(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching schedule: {e}") print(get_schedule()) ``` -------------------------------- ### Search Anime with AnimeSama Provider (JavaScript, Python) Source: https://docs.consumet.org/rest-api/Anime/animesama/search Provides example code for searching anime using the AnimeSama provider. It demonstrates how to construct the API request URL and handle the response. This functionality requires an internet connection to reach the Consumet API. ```javascript import axios from "axios"; // Using the example query "naruto". const url = "https://api.consumet.org/anime/animesama/naruto"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "naruto". url = "https://api.consumet.org/anime/animesama/naruto" def get_anime_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise ConnectionError(f"Error fetching data: {e}") print(get_anime_data()) ``` -------------------------------- ### Get Anilist Anime Data by ID (JavaScript) Source: https://docs.consumet.org/rest-api/Meta/anilist-anime/get-anilist-data Retrieves meta data for a specific anime from Anilist using its ID. This JavaScript example utilizes the 'axios' library to make a GET request to the Consumet API. It handles potential errors during the request. ```javascript import axios from "axios"; // Using the example id of "21" (one piece) const url = "https://api.consumet.org/meta/anilist/data/21"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Get Dramacool Movie Info (Python) Source: https://docs.consumet.org/rest-api/Movies/dramacool/get-movie-info Retrieves movie information from Dramacool via the Consumet API. This Python example uses the 'requests' library to send a GET request with the movie ID. It returns a JSON response containing the movie's metadata. ```python import requests # Using the example query "drama-detail/vincenzo", and looking at the 1st page of results. url = "https://api.consumet.org/movies/dramacool/info?id=drama-detail/vincenzo" def get_movie_info(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(e) print(get_movie_info()) ``` -------------------------------- ### Get Anime Info from MyAnimeList (Python) Source: https://docs.consumet.org/rest-api/Meta/myanimelist/get-anime-info Retrieves anime details from MyAnimeList via the Consumet API. This Python example uses the 'requests' library to send a GET request. It requires the anime ID and can optionally specify a provider and dub status. ```python import requests # Using the example id of "16498" (Jujutsu Kaisen) url = "https://api.consumet.org/meta/mal/info/16498" def get_anime_info(): try: response = requests.get(url, params={'provider': 'gogoanime', 'dub': False}) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(str(e)) print(get_anime_info()) ``` -------------------------------- ### Search Animepahe Provider (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Anime/animepahe/search Provides example code for searching the animepahe provider using the Consumet API. It demonstrates how to construct the request URL and handle the response. The function takes a search query as input and returns a JSON object containing search results. ```javascript import axios from "axios"; // Using the example query "demon". const url = "https://api.consumet.org/anime/animepahe/demon"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "demon". url = "https://api.consumet.org/anime/animepahe/demon" def get_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(str(e)) print(get_data()) ``` -------------------------------- ### Get Trending Manga from Mangahere (Python) Source: https://docs.consumet.org/rest-api/Manga/mangahere/trending Retrieves trending manga from the Mangahere provider via the Consumet API. This Python example demonstrates how to make a GET request to the trending endpoint and process the JSON response. It requires the 'requests' library for HTTP communication. ```python import requests url = "https://api.consumet.org/manga/mangahere/trending" def get_trending_manga(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching trending manga: {e}") if __name__ == "__main__": trending_data = get_trending_manga() print(trending_data) ``` -------------------------------- ### Get Trending Manga from Mangahere (JavaScript) Source: https://docs.consumet.org/rest-api/Manga/mangahere/trending Fetches a list of trending manga from the Mangahere provider using the Consumet API. This JavaScript example utilizes the 'axios' library to make a GET request to the trending endpoint. It returns the JSON response containing manga results. ```javascript import axios from "axios"; const url = "https://api.consumet.org/manga/mangahere/trending"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` -------------------------------- ### Get Manga Rankings - Python Source: https://docs.consumet.org/rest-api/Manga/mangahere/rankings Retrieves manga rankings from the Mangahere provider using Python and the requests library. This example demonstrates how to construct the API endpoint URL and make a GET request to fetch the ranking data. Error handling is included for network issues. ```python import requests # Using the example type "week". url = "https://api.consumet.org/manga/mangahere/rankings?type=week" def get_manga_rankings(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching data: {e}") return None print(get_manga_rankings()) ``` -------------------------------- ### Search NovelUpdates API (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Light-Novels/novelupdates/search Demonstrates how to search for light novels on NovelUpdates using the Consumet API. It includes examples for both JavaScript and Python, showing how to construct the request URL and handle the response. The code requires the 'axios' library for JavaScript. ```javascript import axios from "axios"; // Using the example query "solo leveling". const url = "https://api.consumet.org/light-novels/novelupdates/solo%20leveling"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "solo leveling". query = "solo leveling" url = f"https://api.consumet.org/light-novels/novelupdates/{query.replace(' ', '%20')}" try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Get Recent Movies from Goku Provider (Python) Source: https://docs.consumet.org/rest-api/Movies/goku/recent-movies Retrieves recent movies from the Goku provider via the Consumet API. This Python example demonstrates how to make an HTTP GET request to the API endpoint and process the JSON response. It is suitable for integration into Python applications. ```python import requests url = "https://api.consumet.org/movies/goku/recent-movies" try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error fetching data: {e}") ``` -------------------------------- ### Get OVA Anime (Animekai) - Python Source: https://docs.consumet.org/rest-api/Anime/animekai/ova Retrieves OVA anime from the Animekai provider via the Consumet API. This Python example uses the 'requests' library to send a GET request to the API endpoint, allowing for pagination. It returns the JSON response or handles potential request errors. ```python import requests url = "https://api.consumet.org/anime/animekai/ova" def get_ova_anime(page=1): try: response = requests.get(url, params={'page': page}) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching OVA anime: {e}") # Example usage: # print(get_ova_anime()) ``` -------------------------------- ### Search Suggestions for HiAnime (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Anime/hianime/search-suggestions This snippet demonstrates how to fetch search suggestions from the HiAnime provider using the Consumet API. It includes examples for both JavaScript and Python, showing how to construct the request URL and handle the response. The function takes a search query as input and returns a list of suggested anime titles. ```javascript import axios from "axios"; // Using the example query "one piece". const url = "https://api.consumet.org/anime/hianime/search-suggestions/one%20piece"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "one piece". query = "one piece" url = f"https://api.consumet.org/anime/hianime/search-suggestions/{query.replace(' ', '%20')}" def get_search_suggestions(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching search suggestions: {e}") print(get_search_suggestions()) ``` -------------------------------- ### Get Movies from Animekai (Python) Source: https://docs.consumet.org/rest-api/Anime/animekai/movies Retrieves movie data from the animekai provider via the Consumet API. This example demonstrates making a GET request to the API endpoint using the requests library, with support for specifying the page number. It handles potential request errors and returns the movie results. ```python import requests url = "https://api.consumet.org/anime/animekai/movies" params = { "page": 1 } try: response = requests.get(url, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") ``` -------------------------------- ### Get Spotlight Content from DramaCool (Python) Source: https://docs.consumet.org/rest-api/Movies/dramacool/spotlight Fetches featured content from DramaCool's homepage using an HTTP GET request. Requires the 'requests' library for making requests. Returns a JSON array of spotlight items. ```python import requests url = "https://api.consumet.org/movies/dramacool/spotlight" def get_spotlight_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(f"Error fetching data: {e}") print(get_spotlight_data()) ``` -------------------------------- ### Use Image Proxy in HTML Source: https://docs.consumet.org/rest-api/Manga/mangadex/proxy Demonstrates how to directly embed the proxied manga image in an HTML `` tag. Replace `YOUR_ENCODED_IMAGE_URL` with the URL-encoded image source. ```html Manga Image ``` -------------------------------- ### Search Manga via WeebCentral (JavaScript & Python) Source: https://docs.consumet.org/rest-api/Manga/weebcentral/search Provides example code for searching manga on WeebCentral using the Consumet API. It demonstrates how to construct the API request URL and handle the response. The 'query' parameter is mandatory for specifying the search term. ```javascript import axios from "axios"; // Using the example query "one piece". const url = "https://api.consumet.org/manga/weebcentral/one piece"; const data = async () => { try { const { data } = await axios.get(url); return data; } catch (err) { throw new Error(err.message); } }; console.log(data); ``` ```python import requests # Using the example query "one piece". url = "https://api.consumet.org/manga/weebcentral/one piece" def get_data(): try: response = requests.get(url) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: raise Exception(str(e)) print(get_data()) ```