Skip to content

Commit

Permalink
change base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshikuniii committed Dec 28, 2023
1 parent cd9239d commit c12dfa8
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 23 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,25 @@ The project is a work in progress, not finished yet. But, the code works well, f

For complete code, see `example.py`.
<p align="center">
<img src="https://github.com/yoshikuniii/pynime/blob/main/pynimeapi/raw/demo.gif"></p>
<img src="https://github.com/yoshikuniii/pynime/blob/main/pynimeapi/raw/demo.gif"></p>

## How To Install?
Minimum Python version 3.8+
It will install the dependencies automatically.
```sh
pip install git+https://github.com/yoshikuniii/pynime.git
```

## 1. Initialize the API

First, you need to initialize the PyNime class.

```Python
from pynimeapi import PyNime
api = PyNime(base_url = "https://gogoanimeapp.com")
api = PyNime(base_url = "https://anitaku.to")
```

> **Note:** GoGoAnime often change their domain, you can change the `base_url` if they change it. Otherwise, leave it blank. The default URL will refer to https://gogoanimeapp.com
> **Note:** GoGoAnime often change their domain, you can change the `base_url` if they change it. Otherwise, leave it blank. The default URL will refer to https://anitaku.to/. More info visit https://gogotaku.info/
## 2. Search an Anime

Expand Down
Binary file removed demo-1.gif
Binary file not shown.
Binary file removed demo.gif
Binary file not shown.
9 changes: 6 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pynimeapi import PyNime

# Init the API
api = PyNime(base_url="https://gogoanimeapp.com")
api = PyNime(base_url="https://anitaku.to")

# Search an anime
anime_title = input("Input anime title: ")
Expand All @@ -23,7 +23,10 @@
print(anime_details.title)
print(anime_details.season)
print(anime_details.synopsis)
print(anime_details.genres) # output on list data type. Example : ['Comedy', 'Ecchi', 'Slice of Life']

# anitaku not giving anime genres detail
# print(anime_details.genres) # output on list data type. Example : ['Comedy', 'Ecchi', 'Slice of Life']

print(anime_details.status)
print(anime_details.image_url)

Expand Down Expand Up @@ -58,7 +61,7 @@
recent_anime = api.get_recent_release(page=1)

for anime in recent_anime:
# print first 20 anime recently uploaded on GoGoAnime homepage
# print first 20 anime recently uploaded on GoGoAnime/ homepage
print(f"{anime.title} [EP : {anime.latest_episode}] [URL : {anime.latest_episode_url}]")

# Get Schedule
Expand Down
10 changes: 4 additions & 6 deletions pynimeapi/downloader/http_downloader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import re
import sys
import time
import requests

class HTTPDownloader:
Expand All @@ -13,10 +11,10 @@ def __init__(self):
}

def remove_forbiden_string(self, input_string):
''' Remove char that forbiden while creating a file such as ? * | etc
'''
new_string = re.sub('[:><?/|* ]+', '', input_string)
return new_string
''' Remove char that forbiden while creating a file such as ? * | etc
'''
new_string = re.sub('[:><?/|* ]+', '', input_string)
return new_string

def progress_bar(self, iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', print_end = '\r'):
''' Make CLI progressbar.
Expand Down
20 changes: 11 additions & 9 deletions pynimeapi/pynime.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@


class PyNime:
def __init__(self, base_url: str = "https://gogoanimeapp.com"):
def __init__(self, base_url: str = "https://anitaku.to"):
self.baseURL = base_url # domain of GoGoAnime. please update regularly

def version(self):
return "0.1.57"
return "0.1.58"

def search_anime(self, anime_title: str) -> SearchResultObj:
"""
Expand Down Expand Up @@ -75,14 +75,16 @@ def get_anime_details(self, anime_category_url: str) -> AnimeDetailsObj:
title = info_body.find("h1").text.strip()
season = other_info[0].text.replace("\n", "").replace("Type: ", "")
synopsis = other_info[1].text.replace("\n", "")

# look for genres
genres = [] # empty list
pattern_genres = re.compile(r'Genre:\s*(.*)$')
match_genres = pattern_genres.search(other_info[3].text.replace("\n", ""))
# Anitaku not giving anime genres detail.

# genres = [] # empty list
# pattern_genres = re.compile(r'Genre:\s*(.*)$')
# match_genres = pattern_genres.search(other_info[3].text.replace("\n", ""))

if match_genres:
genres = match_genres.group(1).split(', ')
# if match_genres:
# genres = match_genres.group(1).split(', ')


status = other_info[4].text.replace("\n", "").replace("Status: ", "")
Expand All @@ -92,7 +94,7 @@ def get_anime_details(self, anime_category_url: str) -> AnimeDetailsObj:
title=title,
season=season,
synopsis=synopsis,
genres=genres,
# genres=genres,
status=status,
image_url=image_url
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pynimeapi"
version = "0.1.57"
version = "0.1.58"
description = "Yet simple API wrapper for GoGoAnime"
authors = ["Yoshkuni Kuniumi <101183804+yoshikuniii@users.noreply.github.com>"]
license = "GNU General Public License v3.0"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

VERSION = '0.1.57'
VERSION = '0.1.58'
DESCRIPTION = 'Yet simple API wrapper for GoGoAnime'
LONG_DESCRIPTION = 'PyNime is a (simple) straightforward Python3 script to scrape GoGoAnime using Python. The project ' \
'is a work in progress, not finished yet. But, the code works well, feel free to take part of the ' \
Expand Down

0 comments on commit c12dfa8

Please sign in to comment.