diff --git a/pynimeapi/classes/datatype.py b/pynimeapi/classes/datatype.py index 677de80..3db99db 100644 --- a/pynimeapi/classes/datatype.py +++ b/pynimeapi/classes/datatype.py @@ -1,7 +1,8 @@ class SearchResultObj: - def __init__(self, title: str, category_url: str): + def __init__(self, title: str, category_url: str, picture_url: str): self.title = title self.category_url = category_url + self.picture_url = picture_url def __str__(self): return f"title: {self.title} | category_url: {self.category_url}" @@ -21,7 +22,8 @@ def __init__( self.image_url = image_url class RecentAnimeObj: - def __init__(self, title, latest_episode, latest_episode_url): + def __init__(self, title, latest_episode, latest_episode_url, picture_url): self.title = title self.latest_episode = latest_episode self.latest_episode_url = latest_episode_url + self.picture_url = picture_url diff --git a/pynimeapi/pynime.py b/pynimeapi/pynime.py index 013377f..f685032 100644 --- a/pynimeapi/pynime.py +++ b/pynimeapi/pynime.py @@ -23,6 +23,9 @@ class PyNime: def __init__(self, base_url: str = "https://gogoanime.ar"): self.baseURL = base_url # domain of GoGoAnime. please update regularly + def version(self): + return "0.1.44" + def search_anime(self, anime_title: str) -> SearchResultObj: """ Search anime on given title. @@ -35,13 +38,20 @@ def search_anime(self, anime_title: str) -> SearchResultObj: if r: title = [_.group(1) for _ in re.finditer(r"<\\/div>(.*?)<\\/a><\\/div>", r.text)] url = [_.group(1) for _ in re.finditer(r" RecentAnimeObj: response = requests.get( f"https://ajax.gogo-load.com/ajax/page-recent-release.html?page={page}").text - regex_filter = r"
  • \s*\n.*\n.*.*?-episode-(?P\d+))[\"']\s*title=[\"'](?P.*?)[\"']" + regex_filter = r"<li>\s*\n.*\n.*<a\shref=[\"'](?P<href>.*?-episode-(?P<episode>\d+))[\"']\s*title=[\"'](?P<title>.*?)[\"']>\n.*<img\ssrc=[\"'](?P<img>.*?)[\"']" if response: matches = list(re.findall(regex_filter, response, re.MULTILINE)) @@ -256,7 +266,10 @@ def get_recent_release(self, page=1) -> RecentAnimeObj: RecentAnimeObj( title=match[2], latest_episode=int(match[1]), - latest_episode_url=f"{self.baseURL}{match[0]}")) + latest_episode_url=f"{self.baseURL}{match[0]}", + picture_url=match[3], + ) + ) return recent_release_list except Exception as e: diff --git a/setup.py b/setup.py index 38a7c12..dc896b8 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.1.43' +VERSION = '0.1.44' 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 code.'