Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: update webtoken salt (GoFile) (#27)

NTFSvolume364f0dbba196
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb27438a1..004eb0f52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,12 @@ All notable changes to this project will be documented here. For more details, v
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [9.0.1] - 2026-03-17
+
+### Fixed
+
+- Update website salt (Gofile)
+
## [9.0.0] - 2026-03-09
⚠️**BREAKING CHANGES**
@@ -54,6 +60,7 @@ Several config options:
- Download of multipage profile albums (Chevereto)
- Handle `redirect/to` links (Xenforo)
- Download of files with broken thumbnails (bunkr)
+- Send custom one-time-use headers (GoFile)
- Download subfolder from filesystem URLs (pixeldrain)
## [8.10.0] - 2026-01-26
diff --git a/cyberdrop_dl/crawlers/gofile.py b/cyberdrop_dl/crawlers/gofile.py
index 25a8b077b..be8523ac3 100644
--- a/cyberdrop_dl/crawlers/gofile.py
+++ b/cyberdrop_dl/crawlers/gofile.py
@@ -61,20 +61,6 @@ class Folder(UnlockedNode):
# isRoot: NotRequired[bool]
-class FolderMetadata(TypedDict):
- hasNextPage: bool
-
- # totalCount: int
- # totalPages: int
- # page: int
- # pageSize: int
-
-
-class FolderResponse(Response):
- data: Folder
- metadata: FolderMetadata
-
-
class GoFileCrawler(Crawler):
SUPPORTED_PATHS: ClassVar[SupportedPaths] = {
"Folder / File": "/d/<content_id>",
@@ -92,19 +78,32 @@ class GoFileCrawler(Crawler):
FOLDER_DOMAIN: ClassVar[str] = "GoFile"
_RATE_LIMIT: ClassVar[RateLimit] = 4, 10
+ _SALT: ClassVar[str] = "f4s58gs6"
+ _BROWSER_LANG: ClassVar[str] = "en-US"
+
def __post_init__(self) -> None:
self._api_key: str = ""
@property
def headers(self) -> dict[str, str]:
- return {
+ headers = {
"User-Agent": (ua := self.manager.global_config.general.user_agent),
- "Authorization": f"Bearer {self._api_key}",
- "X-BL": (lang := "en-US"),
- "X-Website-Token": _generate_website_token(ua, self._api_key, lang),
- "Origin": (origin := str(self.PRIMARY_URL)),
- "Referer": origin + "/",
+ "Origin": "https://gofile.io",
+ "Referer": "https://gofile.io/",
}
+ if self._api_key:
+ headers |= {
+ "Authorization": f"Bearer {self._api_key}",
+ "X-BL": self._BROWSER_LANG,
+ "X-Website-Token": _create_web_token(
+ ua,
+ self._BROWSER_LANG,
+ self._api_key,
+ self._SALT,
+ ),
+ }
+
+ return headers
@classmethod
def _json_response_check(cls, json_resp: Response) -> None:
@@ -165,15 +164,14 @@ class GoFileCrawler(Crawler):
self._handle_children(scrape_item, children.values())
def _handle_children(self, scrape_item: ScrapeItem, children: Iterable[Node]) -> None:
- def get_website_url(node: Node) -> AbsoluteHttpURL:
+ def web_url(node: Node) -> AbsoluteHttpURL:
node_id = node["id"]
if node["type"] == "folder":
return _PRIMARY_URL / "d" / (node.get("code") or node_id)
return scrape_item.url.with_fragment(node_id)
for node in children:
- web_url = get_website_url(node)
- new_scrape_item = scrape_item.create_new(web_url, add_parent=True)
+ new_scrape_item = scrape_item.create_new(web_url(node), add_parent=True)
self._handle_node(new_scrape_item, node)
scrape_item.add_children()
@@ -227,7 +225,6 @@ class GoFileCrawler(Crawler):
@error_handling_wrapper
async def _get_credentials(self, _) -> None:
- """Gets the token for the API."""
with self.disable_on_error("Unable to get api_key"):
if key := self.manager.auth_config.gofile.api_key:
self._api_key = key
@@ -238,7 +235,7 @@ class GoFileCrawler(Crawler):
async def _create_temp_account(self) -> str:
self.log("Creating temp Gofile account")
api_url = _API_ENTRYPOINT / "accounts"
- json_resp = await self.request_json(api_url, method="POST", data={})
+ json_resp = await self.request_json(api_url, method="POST", data={}, headers=self.headers)
if json_resp["status"] != "ok":
raise ScrapeError(401, "Couldn't generate GoFile API token", origin=api_url)
@@ -270,7 +267,8 @@ def _has_single_not_nested_file(scrape_item: ScrapeItem, folder: Folder) -> bool
return folder["childrenCount"] == 1 and folder["name"] == folder["code"] and scrape_item.type != FILE_HOST_ALBUM
-def _generate_website_token(ua: str, api_key: str, lang: str = "en-US") -> str:
- # https://gofile.io/dist/js/wt.obf.js
- data = f"{ua}::{lang}::{api_key}::{int(time.time() / 14400)}::gf2026x"
- return sha256(data.encode()).hexdigest()
+def _create_web_token(user_agent: str, brower_lang: str, api_key: str, salt: str) -> str:
+ # "https://gofile.io/dist/js/wt.obf.js"
+ # TODO: Get the salt automatically from the JS code
+ token = f"{user_agent}::{brower_lang}::{api_key}::{int(time.time() // 14400)}::{salt}"
+ return sha256(token.encode()).hexdigest()
diff --git a/pyproject.toml b/pyproject.toml
index 76f117e69..7852dcc09 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -42,7 +42,7 @@ license = "GPL-3.0-only"
license-files = ["LICENSE"]
readme = "README.md"
requires-python = ">=3.11"
-version = "9.0.0"
+version = "9.0.1"
[project.scripts]
cyberdrop-dl = "cyberdrop_dl.main:main"
diff --git a/uv.lock b/uv.lock
index d9d7d118c..ecd068c03 100644
--- a/uv.lock
+++ b/uv.lock
@@ -714,7 +714,7 @@ wheels = [
[[package]]
name = "cyberdrop-dl-patched"
-version = "9.0.0.dev0"
+version = "9.0.1"
source = { editable = "." }
dependencies = [
{ name = "aiodns" },