Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地部署后运行自写路由时出错 #2656

Closed
Kiotlin opened this issue Jul 19, 2019 · 4 comments
Closed

本地部署后运行自写路由时出错 #2656

Kiotlin opened this issue Jul 19, 2019 · 4 comments

Comments

@Kiotlin
Copy link
Contributor

Kiotlin commented Jul 19, 2019

路由地址

在本地部署了RSSHub
http://127.0.0.1:1200/ff14/ff14_zh

预期是什么?

正常访问生成的RSS页面

实际发生了什么?

以下是页面上错误回执

RSSHub 发生了一些意外:
TypeError: Cannot read property 'map' of undefined
at module.exports (D:\RSSHub-master\lib\routes\ff14\ff14_zh.js:20:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
打开源码自带的路由生成的RSS界面都是成功的,自己测试了下对url进行请求也是200,不知道这个是什么原因导致的

部署相关信息

调用data.map()的相关代码
image

@Kiotlin
Copy link
Contributor Author

Kiotlin commented Jul 19, 2019

定位到原因了,是data为undefined导致的,但是这又是什么导致的呢,我用python写脚本请求这个链接是200,而且也有返回json,不知道这个got函数是怎么执行的。

const referer = 'http://ff.sdo.com/web8/index.html';
const response = await got({
        method: 'get',
        url: "http://api.act.sdo.com/UnionNews/List?gameCode=ma&category=5309,5310,5311,5312,5313&pageIndex=0&pageSize=70&callback=_jsonpjfzvowq9x8",
        headers: {
            UserAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
            Referer: referer,
        },
    });

    const data = response.data.data;

@SettingDust
Copy link
Contributor

SettingDust commented Jul 20, 2019

@wdssmq
Copy link
Contributor

wdssmq commented Jul 20, 2019

返回值里是Data,区分大小写的,然而你的map()里的传参好像也不对。。

@Kiotlin
Copy link
Contributor Author

Kiotlin commented Jul 20, 2019

感谢两位大佬指导,问题解决了

@Kiotlin Kiotlin closed this as completed Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants