Skip to content

Bulk asynchronous downloader for multiple file hosts

Add capability to specify Gofile websiteToken in config (#479)

Arkadiy Illarionov0c67a5aecbfd
diff --git a/README.md b/README.md
index 99fad42dd..291901d5e 100644
--- a/README.md
+++ b/README.md
@@ -145,7 +145,7 @@ optional arguments:
--skip-download-mark-completed sets the scraped files as downloaded without downloading
--output-errored-urls sets the failed urls to be output to the errored urls file
--output-unsupported-urls sets the unsupported urls to be output to the unsupported urls file
---proxy HTTP/HTTPS proxy used for downloading, format [protocal]://[ip]:[port]
+--proxy HTTP/HTTPS proxy used for downloading, format [protocol]://[ip]:[port]
--remove-bunkr-identifier removes the bunkr added identifier from output filenames
--required-free-space required free space (in gigabytes) for the program to run
@@ -165,6 +165,7 @@ optional arguments:
--separate-posts separates forum scraping into folders by post number
--gofile-api-key api key for premium gofile
+--gofile-website-token website token for gofile
--pixeldrain-api-key api key for premium pixeldrain
--nudostar-username username to login to nudostar
--nudostar-password password to login to nudostar
diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.py
index 2cc8f92a3..316c93801 100644
--- a/cyberdrop_dl/base_functions/config_schema.py
+++ b/cyberdrop_dl/base_functions/config_schema.py
@@ -7,6 +7,7 @@ config_default: Dict = {
"Configuration": {
"Authentication": {
"gofile_api_key": "",
+ "gofile_website_token": "",
"pixeldrain_api_key": "",
"nudostar_username": "",
"nudostar_password": "",
diff --git a/cyberdrop_dl/crawlers/GoFile_Spider.py b/cyberdrop_dl/crawlers/GoFile_Spider.py
index 93fe75eb1..cbff83f79 100644
--- a/cyberdrop_dl/crawlers/GoFile_Spider.py
+++ b/cyberdrop_dl/crawlers/GoFile_Spider.py
@@ -2,12 +2,12 @@ from __future__ import annotations
import http
import re
-from typing import TYPE_CHECKING, Union, List, Dict
+from typing import TYPE_CHECKING, Dict, List, Union
from aiolimiter import AsyncLimiter
from yarl import URL
-from ..base_functions.base_functions import log, logger, make_title_safe, get_filename_and_ext
+from ..base_functions.base_functions import get_filename_and_ext, log, logger, make_title_safe
from ..base_functions.data_classes import DomainItem, MediaItem
from ..base_functions.error_classes import NoExtensionFailure
@@ -53,11 +53,15 @@ class GoFileCrawler:
log("Error: Couldn't generate GoFile token", quiet=self.quiet, style="red")
logger.debug(e)
- async def get_website_token(self, session: ScrapeSession):
+ async def get_website_token(self, session: ScrapeSession, website_token: str = None):
"""Creates an anon gofile account to use."""
if self.websiteToken:
return
+ if website_token:
+ self.websiteToken = website_token
+ return
+
try:
async with self.limiter:
js_obj = await session.get_text(self.js_address)
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index 5424f3a3c..28f182ff7 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -72,7 +72,7 @@ def parse_args() -> argparse.Namespace:
runtime_opts.add_argument("--skip-download-mark-completed", help="sets the scraped files as downloaded without downloading", action="store_true")
runtime_opts.add_argument("--output-errored-urls", help="sets the failed urls to be output to the errored urls file", action="store_true")
runtime_opts.add_argument("--output-unsupported-urls", help="sets the unsupported urls to be output to the unsupported urls file", action="store_true")
- runtime_opts.add_argument("--proxy", help="HTTP/HTTPS proxy used for downloading, format [protocal]://[ip]:[port]", default=config_group["proxy"])
+ runtime_opts.add_argument("--proxy", help="HTTP/HTTPS proxy used for downloading, format [protocol]://[ip]:[port]", default=config_group["proxy"])
runtime_opts.add_argument("--remove-bunkr-identifier", help="removes the bunkr added identifier from output filenames", action="store_true")
runtime_opts.add_argument("--required-free-space", type=int, default=config_group["required_free_space"], help="required free space (in gigabytes) for the program to run (default: %(default)s)")
@@ -103,6 +103,7 @@ def parse_args() -> argparse.Namespace:
config_group = config_data["Authentication"]
auth_opts = parser.add_argument_group("Authentication options")
auth_opts.add_argument("--gofile-api-key", help="api key for premium gofile", default=config_group["gofile_api_key"])
+ auth_opts.add_argument("--gofile-website-token", help="website token for gofile", default=config_group["gofile_website_token"])
auth_opts.add_argument("--pixeldrain-api-key", help="api key for premium pixeldrain", default=config_group["pixeldrain_api_key"])
auth_opts.add_argument("--nudostar-username", help="username to login to nudostar", default=config_group["nudostar_username"])
auth_opts.add_argument("--nudostar-password", help="password to login to nudostar", default=config_group['nudostar_password'])
diff --git a/cyberdrop_dl/scraper/Scraper.py b/cyberdrop_dl/scraper/Scraper.py
index d6d197205..cdadedc27 100644
--- a/cyberdrop_dl/scraper/Scraper.py
+++ b/cyberdrop_dl/scraper/Scraper.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import asyncio
-from typing import TYPE_CHECKING, Optional, Dict
+from typing import TYPE_CHECKING, Dict, Optional
from yarl import URL
@@ -194,7 +194,8 @@ class ScrapeMapper:
async with self.gofile_semaphore:
await self.gofile_crawler.get_acct_token(session=gofile_session,
api_token=self.args['Authentication']['gofile_api_key'])
- await self.gofile_crawler.get_website_token(session=gofile_session)
+ await self.gofile_crawler.get_website_token(session=gofile_session,
+ website_token=self.args['Authentication']['gofile_website_token'])
domain_obj = await self.gofile_crawler.fetch(gofile_session, url)
await self._handle_domain_additions("gofile", domain_obj, title)
await gofile_session.exit_handler()