{"record":{"id":"71aa07c6995de15d","repo":"DIYgod/RSSHub","slug":"error-71aa07","errorCode":null,"errorMessage":"文章列表不存在或为空","messagePattern":"文章列表不存在或为空","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/dedao/articles.ts","lineNumber":104,"sourceCode":"\n    const response = await got.post('https://m.igetget.com/share/api/course/free/pageTurning', {\n        json: {\n            chapter_id: 0,\n            count: 5,\n            max_id,\n            max_order_num: 0,\n            pid: Number(id),\n            ptype: 24,\n            reverse: true,\n            since_id: 0,\n            since_order_num: 0,\n        },\n        headers,\n    });\n\n    const data = JSON.parse(response.body);\n    if (!data || !data.article_list) {\n        throw new Error('文章列表不存在或为空');\n    }\n\n    const articles = data.article_list;\n\n    const items = await Promise.all(\n        articles.map((article) => {\n            const postUrl = `https://m.igetget.com/share/course/article/article_id/${article.id}`;\n            const postTitle = article.title;\n            const postTime = new Date(article.publish_time * 1000).toUTCString();\n\n            return cache.tryGet<any>(postUrl, async () => {\n                const detailResponse = await got.get(postUrl, { headers });\n                const $ = load(detailResponse.body);\n\n                const scriptTag = $('script')\n                    .filter((_, el) => $(el).text()?.includes('window.__INITIAL_STATE__'))\n                    .text();\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/dedao/articles.ts#L86-L122","documentation":"The dedao (得到) articles route POSTs to the pageTurning API and expects a JSON response containing an article_list array. If the response is falsy or lacks article_list, the route cannot extract any articles. This typically indicates the course ID (pid) is invalid, the course has no free articles, or the API response shape changed.","triggerScenarios":"got.post succeeds but JSON.parse(response.body) yields an object without article_list. The API may return { status: 'error', msg: '...' } or { article_list: null } for invalid course IDs. The ptype: 24 parameter is hardcoded and may not match all course types.","commonSituations":"The id parameter (course ID) is wrong or refers to a paid-only course with no free articles; the igetget API changed its response format or endpoint; the hardcoded ptype: 24 does not match the course type of the requested ID; the API requires authentication that is no longer optional.","solutions":["Verify the course ID by visiting https://m.igetget.com/share/course/free/detail?id=<id> in a browser.","Log the full response body to see the actual API response and any error message.","Check if the ptype parameter needs to be dynamic based on the course type.","Update the API endpoint or headers if the igetget API has changed."],"exampleFix":"// before\nconst data = JSON.parse(response.body);\nif (!data || !data.article_list) {\n    throw new Error('文章列表不存在或为空');\n}\n\n// after — expose the actual API response for diagnosis\nconst data = JSON.parse(response.body);\nif (!data || !data.article_list) {\n    throw new Error(`文章列表不存在或为空 (course id: ${id}, response: ${JSON.stringify(data).slice(0, 200)})`);\n}","handlingStrategy":"validation","validationCode":"const data = JSON.parse(response.body);\nif (response.statusCode !== 200 || !data) {\n    throw new Error(`Dedao API returned status ${response.statusCode}`);\n}\nif (!data.article_list) {\n    throw new Error(`No article_list in response for course ${id}. Response keys: ${Object.keys(data).join(', ')}`);\n}","typeGuard":"function hasArticleList(data: any): data is { article_list: Array<{ id: string; title: string; publish_time: number }> } {\n    return data != null && Array.isArray(data.article_list) && data.article_list.length > 0;\n}","tryCatchPattern":"try {\n    const data = JSON.parse(response.body);\n    if (!data?.article_list) throw new Error('No article_list');\n} catch (e) {\n    if (e instanceof SyntaxError) {\n        throw new Error('Dedao API returned non-JSON response');\n    }\n    throw e;\n}","preventionTips":["Verify the course ID by opening the share URL in a browser.","Log the full API response when article_list is missing.","Check if the ptype parameter needs to be dynamic for different course types."],"tags":["dedao","parsing","api-change","validation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}