Skip to content

fix: load post comments via Reddit GraphQL (v2.3.8) - #27

Merged
mitchross merged 3 commits into
mainfrom
fix/gql-comments
Oct 25, 2026
Merged

mitchross merged 3 commits into
mainfrom
fix/gql-comments

Conversation

@mitchross

Copy link
Copy Markdown
Owner

v2.3.7's encoded-slash workaround no longer works: Reddit now 403s /comments/ JSON routes including %2F (upstream issue redlib-org#591).

Ports open upstream PR redlib-org#603 (2 commits, authorship kept):

  • post metadata from /by_id/t3_{id}.json
  • comments from Android PostComments persisted GraphQL op on gql-fed.reddit.com, converted to the existing two-Listing shape (sorts, focused comment context, cursor pagination)

Fork adaptations: kept fork's post.html title block; CLIENT.load() (fork's client is ArcSwap). Version → 2.3.8.

Verified live from the cluster egress IP (curl_cffi, same Android OAuth flow): comments JSON → 403 (plain and %2F), /by_id → 200, GraphQL PostComments → 200 with 141 comment trees for /r/comfyui 1x8tsgo.

fxmfxmfx and others added 3 commits October 25, 2026 04:16
Reddit rejects anonymous comments JSON requests with an HTML 403, including
encoded-slash paths. Fetch post metadata through by_id and transform the
Android PostComments forest into the Listing shape used by the renderer.

Keep sorting, focused comment context, nested replies, and cursor pagination.
Escape rich text and reject unsafe URL schemes; report upstream HTTP/API
failures without treating them as JSON syntax errors. Cache successful thread
responses for 30 seconds and keep existing OAuth and post access checks.

Adapt the converter and RTJSON renderer from polak14's a63460b implementation,
without the unrelated dependency updates or Shreddit scraper fallback.

Validation: nine GraphQL converter/request tests, cargo fmt and strict clippy;
live anonymous GraphQL requests from the affected container validate sorts,
focused comments, and cursor pagination.

Co-authored-by: polak14 <76823966+polak14@users.noreply.github.com>
Reddit returns DEPENDENCY_FAILURE when PostComments combines an after cursor with focusedCommentContext. A cursor already identifies its subtree, so only send focused context for the initial permalink request. Cover this with request-variable tests and verify the failing nested cursor against the live API.
@mitchross
mitchross merged commit ad08560 into main Oct 25, 2026
8 checks passed
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.

2 participants