{"id":32637867,"url":"https://github.com/can3p/go-substack","last_synced_at":"2026-07-03T15:36:24.569Z","repository":{"id":213378340,"uuid":"733985112","full_name":"can3p/go-substack","owner":"can3p","description":"A package to programmatically interact with drafts on substack","archived":false,"fork":false,"pushed_at":"2023-12-21T16:04:18.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T19:36:19.342Z","etag":null,"topics":["api-client","substack"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/can3p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-20T15:32:20.000Z","updated_at":"2023-12-26T08:39:08.000Z","dependencies_parsed_at":"2024-06-20T19:17:30.120Z","dependency_job_id":"b2c3eb31-65e4-4f71-9c7d-b1a3cfd08602","html_url":"https://github.com/can3p/go-substack","commit_stats":null,"previous_names":["can3p/go-substack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/can3p/go-substack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can3p%2Fgo-substack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can3p%2Fgo-substack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can3p%2Fgo-substack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can3p%2Fgo-substack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/can3p","download_url":"https://codeload.github.com/can3p/go-substack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/can3p%2Fgo-substack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35092210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","substack"],"created_at":"2025-10-31T02:00:40.269Z","updated_at":"2026-07-03T15:36:24.463Z","avatar_url":"https://github.com/can3p.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go-substack - push markdown straight to substack\n\nThis package provides a converter to transform markdown\ninto substack document format and a client to push the document to substack to\ncreate and update drafts, you can check the [notes](https://github.com/can3p/substack-api-notes)\n\n## Example Usage\n\nSee [test](test) folder for example scripts.\n\nCreate a draft:\n\n```\npackage main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\n\t\"github.com/can3p/go-substack/client\"\n\t\"github.com/can3p/go-substack/markdown\"\n\t\"github.com/can3p/go-substack/types\"\n)\n\nfunc main() {\n\tsessionID := flag.String(\"sid\", \"\", \"session id\")\n\tsubstackName := flag.String(\"name\", \"\", \"substack name\")\n\tsubstackID := flag.Int(\"substack-id\", 0, \"substack id\")\n\ttitle := flag.String(\"title\", \"\", \"draft title\")\n\tmd := flag.String(\"md\", \"\", \"markdown text to publish\")\n\n\tflag.Parse()\n\n\tif *sessionID == \"\" || *substackName == \"\" || *md == \"\" || *title == \"\" || *substackID == 0 {\n\t\tpanic(\"all arguments are required\")\n\t}\n\n\tc, err := client.NewClient(nil, *sessionID, *substackName)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdoc, err := markdown.ToDoc(*md)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tctx := context.Background()\n\n\tdraft := \u0026types.Draft{\n\t\tAudience:   \"everyone\",\n\t\tType:       \"newsletter\",\n\t\tDraftTitle: *title,\n\t\tDraftBody:  types.DraftBody(*doc),\n\t\tDraftBylines: []types.DraftBylines{\n\t\t\t{ID: *substackID},\n\t\t},\n\t}\n\n\trespDraft, err := c.CreateNewDraft(ctx, draft)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"You can checkout new draft on https://%s.substack.com/publish/post/%d\\n\", *substackName, respDraft.ID)\n}\n```\n\nYou can run it like this:\n\n```\n$ go run create_draft.go -name substack_name -sid take_from_cookie -title \"test draft from the client 333\" -md \"this is the first paragraph\n\nAnd this is the second one111\" -substack-id 1234\nYou can checkout new draft on https://substack_name.substack.com/publish/post/1456\n```\n\nUpdate an existing draft:\n\n```\npackage main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\n\t\"github.com/can3p/go-substack/client\"\n\t\"github.com/can3p/go-substack/markdown\"\n\t\"github.com/can3p/go-substack/types\"\n)\n\nfunc main() {\n\tsessionID := flag.String(\"sid\", \"\", \"session id\")\n\tsubstackName := flag.String(\"name\", \"\", \"substack name\")\n\tsubstackID := flag.Int(\"substack-id\", 0, \"substack id\")\n\tdraftID := flag.Int(\"draft-id\", 0, \"draft id\")\n\ttitle := flag.String(\"title\", \"\", \"draft title\")\n\tmd := flag.String(\"md\", \"\", \"markdown text to publish\")\n\n\tflag.Parse()\n\n\tif *sessionID == \"\" || *substackName == \"\" || *md == \"\" || *title == \"\" || *substackID == 0 || *draftID == 0 {\n\t\tpanic(\"all arguments are required\")\n\t}\n\n\tc, err := client.NewClient(nil, *sessionID, *substackName)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdoc, err := markdown.ToDoc(*md)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tctx := context.Background()\n\n\tdraft := \u0026types.Draft{\n\t\tAudience:   \"everyone\",\n\t\tType:       \"newsletter\",\n\t\tDraftTitle: *title,\n\t\tDraftBody:  types.DraftBody(*doc),\n\t\tDraftBylines: []types.DraftBylines{\n\t\t\t{ID: *substackID},\n\t\t},\n\t}\n\n\trespDraft, err := c.UpdateDraft(ctx, *draftID, draft)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"You can checkout updated draft on https://%s.substack.com/publish/post/%d\\n\", *substackName, respDraft.ID)\n}\n```\n\nWill be run like this:\n\n```\n$ go run update_draft.go -name substack_name -sid take_from_cookie -title \"test draft from the client\" -md \"this is the first paragraph\n\nAnd this is the second one111234\" -substack-id 12345 -draft-id 456\nYou can checkout updated draft on https://substack_name.substack.com/publish/post/456\n\n```\n\nwhere:\n\n* `sid` is a `substack.sid` cookie that you can extract with dev tools\n* `substack-id` is a substack internal id probable, you can get it from one of the requests with dev tools\n\n## FAQ\n\n### Can I use it?\n\nOnly on your own risk. API is not public and the package can break any time\n\n### Should I use it?\n\nOnly if you're adventurous\n\n### Why should I hunt for the values with dev tools?\n\nAPI is not public and there is no way to use authentenication like OAuth or anything like this. If you know a better way, please let me know!\n\n### Is all markdown supported?\n\nNot at all, you could check [tests](markdown/convert_test.go) to see what's allowed. The good news is that the package should fail conversion in case of unknown markup instead of trying to push garbage\n\n### Are substack specific elements supported?\n\nThey can be, since it's clear how to add the to the substack document format, but not implemented yet. The way to go would be to extend markdown a bit for that\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcan3p%2Fgo-substack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcan3p%2Fgo-substack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcan3p%2Fgo-substack/lists"}