move to user/pass not token

This commit is contained in:
karl.hudgell 2022-01-20 14:47:21 +00:00
parent 79f0c1e248
commit 1852b8fe2e
3 changed files with 51 additions and 19 deletions

View File

@ -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.

View File

@ -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")

View File

@ -1,5 +1,6 @@
{
"GoGoAnimeAuthKey": "",
"GoGoAnime_Username":"",
"GoGoAnime_Password":"",
"MaxConcurrentDownloads": 4,
"CurrentGoGoAnimeDomain": "film",
"OverwriteDownloads": 0