mirror of
https://github.com/karl0ss/GoGoDownloader.git
synced 2025-04-26 11:39:22 +01:00
commit
0b48cca908
@ -146,11 +146,20 @@ def gogodownloader(config):
|
||||
|
||||
dl_links = []
|
||||
episode_links = gogo.get_links(source)
|
||||
|
||||
print(f"{OK}Scraping Links")
|
||||
for link in episode_links:
|
||||
dl_links.append(gogo.get_download_link(link))
|
||||
|
||||
gogo.file_downloader(dl_links)
|
||||
result = gogo.file_downloader(dl_links)
|
||||
if len(result.errors) > 0:
|
||||
while len(result.errors) > 0:
|
||||
print(f"{ERR}{len(result.errors)} links failed retrying.")
|
||||
episode_links = gogo.get_links(source)
|
||||
print(f"{OK}Re-Scraping Links")
|
||||
dl_links.clear()
|
||||
for link in episode_links:
|
||||
dl_links.append(gogo.get_download_link(link))
|
||||
result = gogo.file_downloader(dl_links, overwrite_downloads=0)
|
||||
|
||||
use_again = input(f"{IN}Do you want to use the app again? (y|n) > ").lower()
|
||||
if use_again == "y":
|
||||
|
47
backend.py
47
backend.py
@ -1,3 +1,4 @@
|
||||
import re
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
@ -120,17 +121,42 @@ class gogoanime:
|
||||
url,
|
||||
cookies=dict(auth=gogoanime.get_gogoanime_auth_cookie(self)),
|
||||
)
|
||||
|
||||
quality_arr = ["1080", "720", "640", "480"]
|
||||
soup = BeautifulSoup(page.content, "html.parser")
|
||||
|
||||
for link in soup.find_all("a", href=True):
|
||||
if self.episode_quality in link.text:
|
||||
try:
|
||||
for link in soup.find_all(
|
||||
"a", href=True, string=re.compile(self.episode_quality)
|
||||
):
|
||||
return link["href"]
|
||||
else:
|
||||
ep_num = url.rsplit("-", 1)[1]
|
||||
print(
|
||||
f"{self.episode_quality} not found for ep{ep_num} checking for next best"
|
||||
)
|
||||
for q in quality_arr:
|
||||
for link in soup.find_all("a", href=True, string=re.compile(q)):
|
||||
print(f"{q} found.")
|
||||
return link["href"]
|
||||
except:
|
||||
print("No matching download found")
|
||||
|
||||
def file_downloader(self, file_list: dict):
|
||||
def file_downloader(self, file_list: dict, overwrite_downloads: bool = None):
|
||||
"""[summary]
|
||||
|
||||
Args:
|
||||
file_list (dict): [description]
|
||||
overwrite_downloads (bool, optional): [description]. Defaults to None.
|
||||
|
||||
Returns:
|
||||
[type]: [description]
|
||||
"""
|
||||
if overwrite_downloads is None:
|
||||
overwrite = self.config["OverwriteDownloads"]
|
||||
else:
|
||||
overwrite = overwrite_downloads
|
||||
dl = Downloader(
|
||||
max_conn=max_concurrent_downloads(self.config["MaxConcurrentDownloads"]),
|
||||
overwrite=self.config["OverwriteDownloads"],
|
||||
overwrite=overwrite,
|
||||
headers=dict(
|
||||
[
|
||||
(
|
||||
@ -147,10 +173,11 @@ class gogoanime:
|
||||
)
|
||||
|
||||
for link in file_list:
|
||||
dl.enqueue_file(
|
||||
link,
|
||||
path=f"./{self.title}",
|
||||
)
|
||||
if link is not None:
|
||||
dl.enqueue_file(
|
||||
link,
|
||||
path=f"./{self.title}",
|
||||
)
|
||||
|
||||
files = dl.download()
|
||||
return files
|
||||
|
BIN
img/gogo_icon.ico
Normal file
BIN
img/gogo_icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
1
version.txt
Normal file
1
version.txt
Normal file
@ -0,0 +1 @@
|
||||
3.0.0
|
Loading…
x
Reference in New Issue
Block a user