DIYgod/RSSHub · critical · Error
新闻网登录失败
Error message
新闻网登录失败
What it means
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.
Source
Thrown at lib/routes/gdut/news.ts:50
const $ = load(loginResp.data);
$('input[type=hidden]').each((index, element) => {
postdata[$(element).attr('name')] = $(element).attr('value');
});
// 登录
await got({
method: 'post',
url: site + login,
headers: {
Cookie: cookie,
Referer: site + login,
},
form: postdata,
}).catch((e) => {
if (e.statusCode === 302) {
if (/UserLogin/.test(e.headers.location)) {
throw new Error('新闻网登录失败');
}
} else {
throw e;
}
});
return cookie;
}
export default async (ctx) => {
const page = '/ArticleList.aspx?category=4';
// 缓存cookie
let cookie = await cache.get(site + page);
if (!cookie) {
cookie = await getCookie();
cache.set(site + page, cookie);
}
View on GitHub (pinned to bed535e087)
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).
Example fix
// before
}).catch((e) => {
if (e.statusCode === 302) {
if (/UserLogin/.test(e.headers.location)) {
throw new Error('新闻网登录失败');
}
} else {
throw e;
}
});
// after
// The news.gdut.edu.cn site is decommissioned. Remove this route.
// If a replacement public feed exists, switch to it and drop the login flow. Defensive patterns
Strategy: try-catch
Prevention
- 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).
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Not found ${type} in ${id}: ${currentUrl}
- BAIDU_COOKIE must contain BDUSS. Please check your cookie co
- message ?? code
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
- 对应 loginUid 的 Bilibili 用户的 Cookie 已过期
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/854e212eece9fdcf.
Report an issue: GitHub.