{"record":{"id":"df002c0ac74ddac8","repo":"DIYgod/RSSHub","slug":"medium-user-cookie","errorCode":null,"errorMessage":"缺少 Medium 用户 ${user} 登录后的 Cookie 值","messagePattern":"缺少 Medium 用户 (.+?) 登录后的 Cookie 值","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/medium/following.ts","lineNumber":39,"sourceCode":"        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: 'Personalized Recommendations - Following',\n    maintainers: ['ImSingee'],\n    handler,\n    description: `::: warning\nPersonalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.\n:::`,\n};\n\nasync function handler(ctx) {\n    const user = ctx.req.param('user');\n\n    const cookie = config.medium.cookies[user];\n    if (cookie === undefined) {\n        throw new ConfigNotFoundError(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`);\n    }\n\n    const posts = await getFollowingFeedQuery(user, cookie);\n    ctx.set('json', posts);\n\n    if (!posts) {\n        // login failed\n        throw new ConfigNotFoundError(`Medium 用户 ${user} 的 Cookie 无效或已过期`);\n    }\n\n    const urls = posts.items.map((data) => data.post.mediumUrl);\n\n    const parsedArticles = await Promise.all(urls.map((url) => parseArticle(ctx, url)));\n\n    return {\n        title: `${user} Medium Following`,\n        link: 'https://medium.com/?feed=following',\n        item: parsedArticles,","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/medium/following.ts#L21-L57","documentation":"ConfigNotFoundError thrown by the Medium 'following' route when no cookie is configured for the given user in config.medium.cookies[user]. Personalized following feeds require an authenticated Medium session cookie, so self-hosting with a valid login cookie is mandatory.","triggerScenarios":"config.medium.cookies[user] is undefined — the user has not added a Cookie entry for this Medium handle in the RSSHub configuration (environment variable MIYOUSHE-like env: MEDIUM_COOKIES or config file).","commonSituations":"Fresh self-hosted RSSHub install without configuring MEDIUM_COOKIES; typo in the user key (cookies keyed by a different handle than the one in the URL); using the public RSSHub instance which intentionally does not set per-user cookies.","solutions":["Set the MEDIUM_COOKIES environment variable or config.medium.cookies entry keyed by the exact Medium username (without @).","After logging into medium.com in a browser, copy the 'sid' / 'cf_obc' cookie values into config.","Restart RSSHub after editing config so the new cookies load.","Confirm the cookie key string matches the :user path segment character-for-character."],"exampleFix":"// config (env)\n// before: MEDIUM_COOKIES not set\n\n// after (env)\nMEDIUM_COOKIES=johndoe=sid%3A1%2C...","handlingStrategy":"validation","validationCode":"const cookie = config.medium.cookies?.[user];\nif (!cookie) {\n    throw new ConfigNotFoundError(`No Medium cookie for ${user}. Set MEDIUM_COOKIES env var.`);\n}","typeGuard":"function hasMediumCookie(user: string): boolean {\n    return Boolean(config.medium.cookies?.[user]);\n}","tryCatchPattern":null,"preventionTips":["Document MEDIUM_COOKIES format in deployment notes.","Key cookies by exact username without @.","Self-host and load-test the cookie before subscribing."],"tags":["medium","config","auth","cookie"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}