Skip to content

Commit

Permalink
Merge pull request #38 from SenZmaKi/v2.1.9
Browse files Browse the repository at this point in the history
v2.1.9
  • Loading branch information
SenZmaKi committed Apr 23, 2024
2 parents db353f0 + 01274a6 commit 4bb8344
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 39 deletions.
5 changes: 2 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# General Info
# Bug fixes

- Add termux port, [senpcli](https://github.com/SenZmaKi/Senpwai/blob/master/docs/senpcli-guide.md) in now installable on android using [termux](https://github.com/termux/termux-app)
- Fix Gogoanime by updating domain name to anitaku.so
- Fix Gogoanime dub downloading sub instead
2 changes: 1 addition & 1 deletion docs/testing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ python -m scrapers.test all --site pahe && python -m scrapers.test all --site go
## Options:

- `--site, -s`: Specify the site (i.e., pahe, gogo). Default: pahe
- `--title, -t`: Specify the anime title. Default: Senyuu
- `--title, -t`: Specify the anime title. Default: "Boku no Hero Academia"
- `--quality, -q`: Specify the video quality (i.e., 360p, 480p, 720p, 1080p). Default: 360p
- `--sub_or_dub, -sd`: Specify sub or dub. Default: sub
- `--path, -p`: Specify the download folder path. Default: ./src/test-downloads
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 = "senpwai"
version = "2.1.8"
version = "2.1.9"
description = "A desktop app for tracking and batch downloading anime"
authors = ["SenZmaKi <[email protected]>"]
license = "GPL v3"
Expand Down
6 changes: 3 additions & 3 deletions scripts/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Senpwai"
#define MyAppVersion "2.1.8"
#define MyAppVersion "2.1.9"
#define MyAppPublisher "AkatsuKi Inc."
#define MyAppURL "https://github.com/SenZmaKi/Senpwai"
#define MyAppExeName "Senpwai.exe"
Expand All @@ -11,10 +11,10 @@
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{B1AC746D-A6F0-44EF-B812.1.8-0DF4571B51}}
AppId={{B1AC746D-A6F0-44EF-B812.1.9-0DF4571B51}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion=2.1.8.0
VersionInfoVersion=2.1.9.0
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
Expand Down
6 changes: 3 additions & 3 deletions scripts/setup_senpcli.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Senpcli"
#define MyAppVersion "2.1.8"
#define MyAppVersion "2.1.9"
#define MyAppPublisher "AkatsuKi Inc."
#define MyAppURL "https://github.com/SenZmaKi/Senpwai"
#define MyAppExeName "Senpcli.exe"
Expand All @@ -11,10 +11,10 @@
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{7D4A0DD5-EACB-45-81FC-2.1.85FCFF05BB6}}
AppId={{7D4A0DD5-EACB-45-81FC-2.1.95FCFF05BB6}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion=2.1.8.0
VersionInfoVersion=2.1.9.0
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
Expand Down
2 changes: 1 addition & 1 deletion senpwai/scrapers/gogo/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re

GOGO = "gogo"
GOGO_HOME_URL = "https://anitaku.to"
GOGO_HOME_URL = "https://anitaku.so"
AJAX_ENTRY_POINT = "https://ajax.gogocdn.net"
AJAX_SEARCH_URL = f"{AJAX_ENTRY_POINT}/site/loadAjaxSearch?keyword="
AJAX_LOAD_EPS_URL = (
Expand Down
51 changes: 29 additions & 22 deletions senpwai/scrapers/gogo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,35 @@ def calculate_total_download_size(
def get_anime_page_content(anime_page_link: str) -> tuple[bytes, str]:
global FIRST_REQUEST
global GOGO_HOME_URL
if FIRST_REQUEST:
try:
FIRST_REQUEST = False
response = CLIENT.get(
anime_page_link,
exceptions_to_raise=(DomainNameError, KeyboardInterrupt),
)
if response.status_code not in RESOURCE_MOVED_STATUS_CODES:
return response.content, anime_page_link
new_anime_page_link = response.headers.get("Location", GOGO_HOME_URL)
# The url in location seems to be in http instead of https but the http one doesn't work
if new_anime_page_link != GOGO_HOME_URL:
new_anime_page_link = new_anime_page_link.replace("http://", "https://")
match = cast(re.Match[str], BASE_URL_REGEX.search(new_anime_page_link))
GOGO_HOME_URL = match.group(1)
return get_anime_page_content(new_anime_page_link)
except DomainNameError:
prev_home_url = GOGO_HOME_URL
GOGO_HOME_URL = get_new_home_url_from_readme(FULL_SITE_NAME)
return get_anime_page_content(
anime_page_link.replace(prev_home_url, GOGO_HOME_URL)
)
try:
response = CLIENT.get(
anime_page_link,
exceptions_to_raise=(DomainNameError, KeyboardInterrupt),
)
if response.status_code not in RESOURCE_MOVED_STATUS_CODES:
return response.content, anime_page_link
new_anime_page_link = response.headers.get("Location", anime_page_link)
# The url in location seems to be in http instead of https but the http one doesn't work
new_anime_page_link = new_anime_page_link.replace("http://", "https://")
# If the link is not different we assume they changed their domain name but didn't pass
# the link with the new one in the location headers
if new_anime_page_link == anime_page_link:
raise DomainNameError(Exception("Received resource moved status code"))
match = cast(re.Match[str], BASE_URL_REGEX.search(new_anime_page_link))
GOGO_HOME_URL = match.group(1)
return get_anime_page_content(new_anime_page_link)
except DomainNameError:
# Only check for a new domain name in the readme if this was the first raised error
# otherwise sth else probably broke
if not FIRST_REQUEST:
raise
FIRST_REQUEST = False
prev_home_url = GOGO_HOME_URL
GOGO_HOME_URL = get_new_home_url_from_readme(FULL_SITE_NAME)
return get_anime_page_content(
anime_page_link.replace(prev_home_url, GOGO_HOME_URL)
)

response = CLIENT.get(
anime_page_link,
)
Expand Down
4 changes: 2 additions & 2 deletions senpwai/scrapers/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
PAHE = pahe.PAHE
GOGO = gogo.GOGO

DEFAULT_ANIME_TITLE = "Senyuu"
DEFAULT_ANIME_TITLE = "Boku no Hero Academia"
DEFAULT_QUALITY = "360p"
DEFAULT_START_EPISODE = "1"
DEFAULT_END_EPISODE = "2"
Expand Down Expand Up @@ -446,7 +446,7 @@ def print_usage(self):
Options:
--site, -s Specify the site (i.e., pahe, gogo). Default: pahe
--title, -t Specify the anime title. Default: Senyuu
--title, -t Specify the anime title. Default: "Boku no Hero Academia"
--quality, -q Specify the video quality (i.e., 360p, 480p, 720p, 1080p). Default: 360p
--sub_or_dub, -sd Specify sub or dub. Default: sub
--path, -p Specify the download folder path. Default: ./src/test-downloads
Expand Down
2 changes: 1 addition & 1 deletion senpwai/utils/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

APP_NAME = "Senpwai"
APP_NAME_LOWER = "senpwai"
VERSION = "2.1.8"
VERSION = "2.1.9"
DESCRIPTION = "A desktop app for tracking and batch downloading anime"

IS_PIP_INSTALL = False
Expand Down
7 changes: 5 additions & 2 deletions senpwai/windows/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,6 @@ def initiate_download_pipeline(self, anime_details: AnimeDetails):
self.cancel_icon = Icon(30, 30, CANCEL_ICON_PATH)
self.download_queue = DownloadQueue(self)

if anime_details.sub_or_dub == DUB:
anime_details.anime.page_link = anime_details.dub_page_link
if anime_details.site == PAHE:
return PaheGetEpisodePageInfo(
self,
Expand Down Expand Up @@ -1000,6 +998,11 @@ def __init__(
self.finished.connect(callback)

def run(self):
if self.anime_details.sub_or_dub == DUB:
(
self.anime_details.anime_page_content,
self.anime_details.anime.page_link,
) = gogo.get_anime_page_content(self.anime_details.dub_page_link)
anime_id = gogo.extract_anime_id(self.anime_details.anime_page_content)
download_page_links = gogo.get_download_page_links(
self.anime_details.lacked_episode_numbers[0],
Expand Down

0 comments on commit 4bb8344

Please sign in to comment.