Skip to content

Gofile fix#479

Open
TGxIRFAN wants to merge 1 commit intoSilentDemonSD:wzv3from
TGxIRFAN:patch-5
Open

Gofile fix#479
TGxIRFAN wants to merge 1 commit intoSilentDemonSD:wzv3from
TGxIRFAN:patch-5

Conversation

@TGxIRFAN
Copy link
Copy Markdown
Contributor

@TGxIRFAN TGxIRFAN commented Mar 7, 2026

Now upload fine

Summary by Sourcery

Bug Fixes:

  • Fix Gofile downloads by updating the website token generation and related headers sent to the Gofile contents API.

Now upload fine

Signed-off-by: AS TG <126592884+TGxIRFAN@users.noreply.github.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 7, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the Gofile direct-link generator to compute and send a dynamic, hashed website token and an additional localization header when fetching folder contents, aligning the client headers with Gofile’s current API expectations so uploads/downloads work again.

Sequence diagram for updated Gofile folder contents fetch

sequenceDiagram
    participant Bot as BotDownloader
    participant DLG as DirectLinkGenerator
    participant Gofile as GofileAPI

    Bot->>DLG: requestFolderLinks(folderId)
    DLG->>DLG: time_slot = int(time) // 14400
    DLG->>DLG: raw = user_agent::en-US::token::time_slot::gf2026x
    DLG->>DLG: wt = sha256(raw)
    DLG->>Gofile: GET /contents/{id}
    activate Gofile
    Note right of DLG: Headers
    DLG-->>Gofile: User-Agent, Authorization Bearer token
    DLG-->>Gofile: X-Website-Token = wt
    DLG-->>Gofile: X-BL = en-US
    Gofile-->>DLG: JSON folder contents
    deactivate Gofile
    DLG-->>Bot: directDownloadLinks
Loading

File-Level Changes

Change Details Files
Generate a dynamic website token for Gofile API requests instead of using a hard-coded value, and send an additional language header.
  • Compute a 4-hour time-slot value from the current Unix timestamp.
  • Build a raw signature string from the user agent, locale, token, time slot, and a fixed suffix, then hash it with SHA-256.
  • Replace the static X-Website-Token header value with the computed hash.
  • Add an X-BL header set to en-US for Gofile API requests when fetching contents.
bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py

Possibly linked issues

  • #(unknown): The PR updates Gofile API headers and token generation, fixing the dead mirror/leech behavior described in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new time_slot / wt computation introduces several magic constants (14400, gf2026x, locale string) and a specific format; consider extracting these into named constants or a small helper function with a brief comment so it’s clear what they represent and easier to adjust if the API changes again.
  • Since time() is used directly to derive the website token, it might be safer to centralize time retrieval (e.g., via a helper or dependency-injected clock) to avoid inconsistencies in testing or in environments with skewed system time.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `time_slot` / `wt` computation introduces several magic constants (`14400`, `gf2026x`, locale string) and a specific format; consider extracting these into named constants or a small helper function with a brief comment so it’s clear what they represent and easier to adjust if the API changes again.
- Since `time()` is used directly to derive the website token, it might be safer to centralize time retrieval (e.g., via a helper or dependency-injected clock) to avoid inconsistencies in testing or in environments with skewed system time.

## Individual Comments

### Comment 1
<location path="bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py" line_range="1231-1232" />
<code_context>

     def __fetch_links(session, _id, folderPath="", retry=True):
         _url = f"https://api.gofile.io/contents/{_id}?cache=true"
+        time_slot = int(time()) // 14400
+        raw = f"{user_agent}::en-US::{token}::{time_slot}::gf2026x"
+        wt = sha256(raw.encode()).hexdigest()
         headers = {
</code_context>
<issue_to_address>
**suggestion:** Avoid duplicating the locale string literal to reduce potential for drift.

The string "en-US" now appears both in `raw` and in the `X-BL` header. To avoid inconsistencies if the locale ever changes or becomes configurable, extract it into a local variable (e.g. `locale = "en-US"`) and reference that in both places.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant