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 ctypes
|
||||
import os
|
||||
from backend import Download, CustomMessage, config_check
|
||||
from backend import gogoanime, CustomMessage, config_check
|
||||
from bs4 import BeautifulSoup
|
||||
from colorama import Fore
|
||||
|
||||
@ -125,7 +125,7 @@ def gogodownloader(config):
|
||||
else:
|
||||
episode_end = all_episodes
|
||||
|
||||
download = Download(
|
||||
gogo = gogoanime(
|
||||
config,
|
||||
name,
|
||||
episode_quality,
|
||||
@ -145,12 +145,12 @@ def gogodownloader(config):
|
||||
source = None
|
||||
|
||||
dl_links = []
|
||||
episode_links = download.get_links(source)
|
||||
episode_links = gogo.get_links(source)
|
||||
|
||||
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()
|
||||
if use_again == "y":
|
@ -30,11 +30,11 @@ GoGo Anime has changed the way they show download links, and this no longer work
|
||||
|
||||
## Installation
|
||||
|
||||
- ```git clone https://github.com/karl0ss/GoGoDownloader.git```
|
||||
- ```pip install -r requirements.txt```
|
||||
- `git clone https://github.com/karl0ss/GoGoDownloader.git`
|
||||
- `pip install -r requirements.txt`
|
||||
- Create config.json from config.json.default
|
||||
- Add your GoGoAnime auth token from the ```auth``` cookie in your browser to the config.json
|
||||
- Run the app with ```python main.py```
|
||||
- Add your GoGoAnime username and password to config.json (Can't be a Google account)
|
||||
- Run the app with `python main.py`
|
||||
|
||||
## 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`.
|
||||
|
||||
|
||||
## 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.
|
||||
|
42
backend.py
42
backend.py
@ -26,8 +26,15 @@ def config_check():
|
||||
if os.path.exists("./config.json"):
|
||||
with open("./config.json", "r") as f:
|
||||
CONFIG = json.load(f)
|
||||
if not "GoGoAnimeAuthKey" in CONFIG or len(CONFIG["GoGoAnimeAuthKey"]) == 0:
|
||||
print("GoGoAnimeAuthKey not set in config.json")
|
||||
if not "GoGoAnime_Username" in CONFIG or len(CONFIG["GoGoAnime_Username"]) == 0:
|
||||
print("GoGoAnime_Username not set in config.json")
|
||||
exit(0)
|
||||
else:
|
||||
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
|
||||
@ -55,7 +62,7 @@ CURRENT_DOMAIN = "film"
|
||||
|
||||
|
||||
@dataclass(init=True)
|
||||
class Download:
|
||||
class gogoanime:
|
||||
config: object
|
||||
name: str
|
||||
episode_quality: str
|
||||
@ -66,6 +73,32 @@ class Download:
|
||||
title: str
|
||||
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):
|
||||
if source is not None:
|
||||
source_ep = f"https://gogoanime.{self.config['CurrentGoGoAnimeDomain']}/{self.name}-episode-"
|
||||
@ -83,10 +116,9 @@ class Download:
|
||||
return episode_links
|
||||
|
||||
def get_download_link(self, url):
|
||||
|
||||
page = requests.get(
|
||||
url,
|
||||
cookies=dict(auth=self.config["GoGoAnimeAuthKey"]),
|
||||
cookies=dict(auth=gogoanime.get_gogoanime_auth_cookie(self)),
|
||||
)
|
||||
|
||||
soup = BeautifulSoup(page.content, "html.parser")
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"GoGoAnimeAuthKey": "",
|
||||
"GoGoAnime_Username":"",
|
||||
"GoGoAnime_Password":"",
|
||||
"MaxConcurrentDownloads": 4,
|
||||
"CurrentGoGoAnimeDomain": "film",
|
||||
"OverwriteDownloads": 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user