mirror of
https://github.com/karl0ss/GoGoDownloader.git
synced 2025-04-26 11:39:22 +01:00
Merge pull request #2 from karl0ss/move_to_userpass
Move to userpass - v2.0.0
This commit is contained in:
commit
259973f780
@ -1,7 +1,7 @@
|
|||||||
import requests
|
import requests
|
||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
from backend import Download, CustomMessage, config_check
|
from backend import gogoanime, CustomMessage, config_check
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from colorama import Fore
|
from colorama import Fore
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ def gogodownloader(config):
|
|||||||
else:
|
else:
|
||||||
episode_end = all_episodes
|
episode_end = all_episodes
|
||||||
|
|
||||||
download = Download(
|
gogo = gogoanime(
|
||||||
config,
|
config,
|
||||||
name,
|
name,
|
||||||
episode_quality,
|
episode_quality,
|
||||||
@ -145,12 +145,12 @@ def gogodownloader(config):
|
|||||||
source = None
|
source = None
|
||||||
|
|
||||||
dl_links = []
|
dl_links = []
|
||||||
episode_links = download.get_links(source)
|
episode_links = gogo.get_links(source)
|
||||||
|
|
||||||
for link in episode_links:
|
for link in episode_links:
|
||||||
dl_links.append(download.get_download_link(link))
|
dl_links.append(gogo.get_download_link(link))
|
||||||
|
|
||||||
download.file_downloader(dl_links)
|
gogo.file_downloader(dl_links)
|
||||||
|
|
||||||
use_again = input(f"{IN}Do you want to use the app again? (y|n) > ").lower()
|
use_again = input(f"{IN}Do you want to use the app again? (y|n) > ").lower()
|
||||||
if use_again == "y":
|
if use_again == "y":
|
23
README.md
23
README.md
@ -17,24 +17,24 @@
|
|||||||
|
|
||||||
GoGo Downloader is based on the now broken **BitAnime**. I have had to rework quite a bit of the code to get it working again, and have ideas for some other improvements, I don't want to mess with the original codebase too much, hence **GoGo Downloader**.
|
GoGo Downloader is based on the now broken **BitAnime**. I have had to rework quite a bit of the code to get it working again, and have ideas for some other improvements, I don't want to mess with the original codebase too much, hence **GoGo Downloader**.
|
||||||
|
|
||||||
**GoGo Downloader** gets its content from [gogoanime](https://gogoanime.film/). If you get a **404** error, please look up the correct anime name on [gogoanime](https://gogoanime.film/). The application will let you download all the episodes, or you can choose how many episodes you want to download.
|
**GoGo Downloader** gets its content from [gogoanime](https://gogoanime.film/). If you get a **404** error, please look up the correct anime name on [gogoanime](https://gogoanime.film/). The application will let you download all the episodes, or you can choose how many episodes you want to download.
|
||||||
|
|
||||||
GoGo Anime has changed the way they show download links, and this no longer works via BS4, as the recaptcha blocks the links, but if you are logged in, there are other routes to get to download links, I have taken one of these routes to restore the application.
|
GoGo Anime has changed the way they show download links, and this no longer works via BS4, as the recaptcha blocks the links, but if you are logged in, there are other routes to get to download links, I have taken one of these routes to restore the application.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Download all qualities options from GoGoAnime
|
- Download all qualities options from GoGoAnime
|
||||||
- Update the current GoGoAnime domain via config file (as they keep changing it)
|
- Update the current GoGoAnime domain via config file (as they keep changing it)
|
||||||
- Specify the number of concurrent downloads via config file (Max is 6)
|
- Specify the number of concurrent downloads via config file (Max is 6)
|
||||||
- Set file overwrite via config file (0 = Skip / 1 = Overwrite)
|
- Set file overwrite via config file (0 = Skip / 1 = Overwrite)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
- ```git clone https://github.com/karl0ss/GoGoDownloader.git```
|
- `git clone https://github.com/karl0ss/GoGoDownloader.git`
|
||||||
- ```pip install -r requirements.txt```
|
- `pip install -r requirements.txt`
|
||||||
- Create config.json from config.json.default
|
- Create config.json from config.json.default
|
||||||
- Add your GoGoAnime auth token from the ```auth``` cookie in your browser to the config.json
|
- Add your GoGoAnime username and password to config.json (Can't be a Google account)
|
||||||
- Run the app with ```python main.py```
|
- Run the app with `python main.py`
|
||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||
@ -47,7 +47,6 @@ GoGo Anime has changed the way they show download links, and this no longer work
|
|||||||
|
|
||||||
**GoGo Downloader** is highly reliant on the python modules `requests`, `colorama`, `parfive`, and `BeautifulSoup`.
|
**GoGo Downloader** is highly reliant on the python modules `requests`, `colorama`, `parfive`, and `BeautifulSoup`.
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The anime name is separated by "-". You can either type it manually, or go to [gogoanime.film](https://gogoanime.film/) and search for the anime you want to download and copy the name from the URL.
|
The anime name is separated by "-". You can either type it manually, or go to [gogoanime.film](https://gogoanime.film/) and search for the anime you want to download and copy the name from the URL.
|
||||||
@ -62,4 +61,4 @@ The anime name is separated by "-". You can either type it manually, or go to [g
|
|||||||
##### Multiple word title
|
##### Multiple word title
|
||||||
|
|
||||||
- https://gogoanime.film/category/shadows-house >> shadows-house
|
- https://gogoanime.film/category/shadows-house >> shadows-house
|
||||||
- https://gogoanime.film/category/kono-subarashii-sekai-ni-shukufuku-wo- >> kono-subarashii-sekai-ni-shukufuku-wo-
|
- https://gogoanime.film/category/kono-subarashii-sekai-ni-shukufuku-wo- >> kono-subarashii-sekai-ni-shukufuku-wo-
|
||||||
|
44
backend.py
44
backend.py
@ -26,11 +26,18 @@ def config_check():
|
|||||||
if os.path.exists("./config.json"):
|
if os.path.exists("./config.json"):
|
||||||
with open("./config.json", "r") as f:
|
with open("./config.json", "r") as f:
|
||||||
CONFIG = json.load(f)
|
CONFIG = json.load(f)
|
||||||
if not "GoGoAnimeAuthKey" in CONFIG or len(CONFIG["GoGoAnimeAuthKey"]) == 0:
|
if not "GoGoAnime_Username" in CONFIG or len(CONFIG["GoGoAnime_Username"]) == 0:
|
||||||
print("GoGoAnimeAuthKey not set in config.json")
|
print("GoGoAnime_Username not set in config.json")
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
return CONFIG
|
if (
|
||||||
|
not "GoGoAnime_Password" in CONFIG
|
||||||
|
or len(CONFIG["GoGoAnime_Password"]) == 0
|
||||||
|
):
|
||||||
|
print("GoGoAnime_Password not set in config.json")
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
return CONFIG
|
||||||
else:
|
else:
|
||||||
print("config.json file not found")
|
print("config.json file not found")
|
||||||
exit(0)
|
exit(0)
|
||||||
@ -55,7 +62,7 @@ CURRENT_DOMAIN = "film"
|
|||||||
|
|
||||||
|
|
||||||
@dataclass(init=True)
|
@dataclass(init=True)
|
||||||
class Download:
|
class gogoanime:
|
||||||
config: object
|
config: object
|
||||||
name: str
|
name: str
|
||||||
episode_quality: str
|
episode_quality: str
|
||||||
@ -66,6 +73,32 @@ class Download:
|
|||||||
title: str
|
title: str
|
||||||
printed: bool = False
|
printed: bool = False
|
||||||
|
|
||||||
|
def get_gogoanime_auth_cookie(self):
|
||||||
|
session = requests.session()
|
||||||
|
page = session.get(
|
||||||
|
f"https://gogoanime.{self.config['CurrentGoGoAnimeDomain']}/login.html"
|
||||||
|
)
|
||||||
|
soup = BeautifulSoup(page.content, "html.parser")
|
||||||
|
meta_path = soup.select('meta[name="csrf-token"]')
|
||||||
|
csrf_token = meta_path[0].attrs["content"]
|
||||||
|
|
||||||
|
url = f"https://gogoanime.{self.config['CurrentGoGoAnimeDomain']}/login.html"
|
||||||
|
payload = f"email={self.config['GoGoAnime_Username']}&password={self.config['GoGoAnime_Password']}&_csrf={csrf_token}"
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
|
||||||
|
"authority": "gogo-cdn.com",
|
||||||
|
"referer": f"https://gogoanime.{self.config['CurrentGoGoAnimeDomain']}/",
|
||||||
|
"content-type": "application/x-www-form-urlencoded",
|
||||||
|
}
|
||||||
|
session.headers = headers
|
||||||
|
|
||||||
|
r = session.post(url, data=payload, headers=headers)
|
||||||
|
|
||||||
|
if r.status_code == 200:
|
||||||
|
return session.cookies.get_dict().get("auth")
|
||||||
|
else:
|
||||||
|
print("ldldl")
|
||||||
|
|
||||||
def get_links(self, source=None):
|
def get_links(self, source=None):
|
||||||
if source is not None:
|
if source is not None:
|
||||||
source_ep = f"https://gogoanime.{self.config['CurrentGoGoAnimeDomain']}/{self.name}-episode-"
|
source_ep = f"https://gogoanime.{self.config['CurrentGoGoAnimeDomain']}/{self.name}-episode-"
|
||||||
@ -83,10 +116,9 @@ class Download:
|
|||||||
return episode_links
|
return episode_links
|
||||||
|
|
||||||
def get_download_link(self, url):
|
def get_download_link(self, url):
|
||||||
|
|
||||||
page = requests.get(
|
page = requests.get(
|
||||||
url,
|
url,
|
||||||
cookies=dict(auth=self.config["GoGoAnimeAuthKey"]),
|
cookies=dict(auth=gogoanime.get_gogoanime_auth_cookie(self)),
|
||||||
)
|
)
|
||||||
|
|
||||||
soup = BeautifulSoup(page.content, "html.parser")
|
soup = BeautifulSoup(page.content, "html.parser")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"GoGoAnimeAuthKey": "",
|
"GoGoAnime_Username":"",
|
||||||
|
"GoGoAnime_Password":"",
|
||||||
"MaxConcurrentDownloads": 4,
|
"MaxConcurrentDownloads": 4,
|
||||||
"CurrentGoGoAnimeDomain": "film",
|
"CurrentGoGoAnimeDomain": "film",
|
||||||
"OverwriteDownloads": 0
|
"OverwriteDownloads": 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user