{"record":{"id":"854e212eece9fdcf","repo":"DIYgod/RSSHub","slug":"error-854e21","errorCode":null,"errorMessage":"新闻网登录失败","messagePattern":"新闻网登录失败","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"lib/routes/gdut/news.ts","lineNumber":50,"sourceCode":"\n    const $ = load(loginResp.data);\n    $('input[type=hidden]').each((index, element) => {\n        postdata[$(element).attr('name')] = $(element).attr('value');\n    });\n\n    // 登录\n    await got({\n        method: 'post',\n        url: site + login,\n        headers: {\n            Cookie: cookie,\n            Referer: site + login,\n        },\n        form: postdata,\n    }).catch((e) => {\n        if (e.statusCode === 302) {\n            if (/UserLogin/.test(e.headers.location)) {\n                throw new Error('新闻网登录失败');\n            }\n        } else {\n            throw e;\n        }\n    });\n    return cookie;\n}\n\nexport default async (ctx) => {\n    const page = '/ArticleList.aspx?category=4';\n\n    // 缓存cookie\n    let cookie = await cache.get(site + page);\n    if (!cookie) {\n        cookie = await getCookie();\n        cache.set(site + page, cookie);\n    }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gdut/news.ts#L32-L68","documentation":"The GDUT news site required a form-based login (hardcoded credentials gdutnews/newsgdut) before listing pages were accessible. The login POST returns a 302 redirect; if the Location header still contains 'UserLogin', the credentials were rejected and the route throws '新闻网登录失败' (news site login failed). Note: the entire module is commented out because news.gdut.edu.cn no longer exists — this error can only fire on a dead/deprecated code path.","triggerScenarios":"The hardcoded credentials were changed on the server, the ASP.NET hidden-field validation (viewstate/eventvalidation) failed so the POST was rejected, or the login endpoint changed. The 302 back to UserLogin is the server's 'login failed' signal.","commonSituations":"Hardcoded shared credentials being rotated by the university; ASP.NET viewstate tampering; the site being replaced (as it has been — the file is fully commented out). This error is effectively unreachable in the current repository.","solutions":["Since the source site (news.gdut.edu.cn) no longer exists and the module is commented out, remove the route entirely rather than fix credentials.","If reviving, fetch fresh hidden fields and update credentials, or switch to a public endpoint that does not require login.","Verify the 302 Location to distinguish credential failure from a WAF challenge (waf_verify)."],"exampleFix":"// before\n}).catch((e) => {\n    if (e.statusCode === 302) {\n        if (/UserLogin/.test(e.headers.location)) {\n            throw new Error('新闻网登录失败');\n        }\n    } else {\n        throw e;\n    }\n});\n\n// after\n// The news.gdut.edu.cn site is decommissioned. Remove this route.\n// If a replacement public feed exists, switch to it and drop the login flow.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove the route since news.gdut.edu.cn is decommissioned.","Do not hardcode credentials in source.","Prefer public endpoints that do not require login.","Distinguish UserLogin redirects (auth failure) from waf_verify redirects (rate limit/CAPTCHA)."],"tags":["deprecated","authentication","dead-code"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}