feat: add rdt post β create post drafts and (captcha-gated) publish - #18
Open
nikicat wants to merge 1 commit into
Open
feat: add rdt post β create post drafts and (captcha-gated) publish#18nikicat wants to merge 1 commit into
rdt post β create post drafts and (captcha-gated) publish#18nikicat wants to merge 1 commit into
Conversation
Add a `rdt post` command that creates Reddit posts through Reddit's web
GraphQL endpoint (svc/shreddit/graphql), reusing the existing cookie session.
Drafts (text/link) are created fully headlessly. Publishing (subreddit
`CreatePost` / profile `CreateProfilePost`, incl. images) is gated behind
reCAPTCHA Enterprise, so it requires a browser-supplied `--recaptcha-token`;
the tool never solves the captcha itself. Image drafts are rejected because
Reddit's draft input type has no media field.
Key pieces:
- transports: TLS fix β httpx's default cipher list produces a ClientHello
that Reddit's WAF blocks on the GraphQL endpoint (403 "blocked by network
security"); reset to ssl.create_default_context() + set_ciphers("DEFAULT").
Pure-Python, no new deps, not impersonation. Also allow application/json
writes on the write transport.
- session: ensure_csrf_token() β double-submit CSRF (same value in cookie
and JSON body; generated if absent).
- client: _graphql, resolve_subreddit_id, create_media_lease, upload_image
(S3 multipart), create_post, create_draft.
- commands/submit.py: the `post` command (--text/--url/--image, --draft,
--recaptcha-token, --nsfw/--spoiler, --json/--yaml; profile via u_<name>).
- tests + README/SKILL docs.
No new runtime dependencies.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
rdt postβ create Reddit posts from the CLI via the web GraphQL API (svc/shreddit/graphql), reusing the existing cookie session. No new runtime dependencies.rdt post <sub> <title> --text "..." --draft.CreatePost/ profileCreateProfilePost, including images) is gated behind reCAPTCHA Enterprise, so it requires a browser-supplied--recaptcha-token(single-use, ~2 min). The tool never solves the captcha itself.Why the TLS change
httpx/httpcore ship a restricted cipher list whose TLS ClientHello is rejected by Reddit's WAF on
POST /svc/shreddit/graphql(403 "blocked by network security") β reads and the legacy/api/*endpoints are unaffected. Resetting tossl.create_default_context()+set_ciphers("DEFAULT")(intransports.build_ssl_context(), applied viaverify=) produces a fingerprint the WAF accepts (stockcurlpasses the same way). Pure-Python, not browser impersonation, no new deps.Command
--draftsaves headlessly; without it,--recaptcha-tokenis required;--image --draftis rejected.Implementation
transports.pyβ TLS SSL-context fix +application/jsonwrites.session.pyβensure_csrf_token()(double-submit CSRF; cookie == body).client.pyβ_graphql,resolve_subreddit_id,create_media_lease,upload_image(S3 multipart),create_post,create_draft.commands/submit.pyβ thepostcommand.constants.py,cli.py, tests, README/SKILL.Testing
pytest, mocked β no network),ruffclean,mypyadds no new errors.π€ Generated with Claude Code