-
Notifications
You must be signed in to change notification settings - Fork 65
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
Cannnot read property 'length' of underfined #30
Comments
同样的报错 😭 |
12306 的接口不接受这种错误的时间,拿不到余票信息,改成正确的时间就可以了,或者联系作者加个提示 |
@smalltimoo |
不是,你输入的是‘2017-02-11’,而事实上现在是买不到2017年的票了的,你要输入能买到票的日期 |
@smalltimoo ...我还活在2017.。 C:\Users\a7822\Downloads\node_12306-master\main.js:251 TypeError: Cannot read property 'length' of undefined |
一样的错误 |
其他的都输入对了吗,这个错误说明返回的result里不是个数组 |
@smalltimoo |
生成的leftTicketUrl不对 |
这几天12306请求头改了等作者更新吧,leftTicketUrl后面加了个Z字符 |
你的leftTicketUrl是啥 |
leftTicketUrl现在是爬12306的另一个网页获取到的 |
我也不行 看到leftTicketUrl好像是"https://kyfw.12306.cn/otn/leftTicket/init" |
我用12306查询发现是'leftTicket/queryZ',你代码里面是'leftTicket/query' |
改成leftTicket/queryZ可以用了 @smalltimoo 谢谢 |
我会在命令行输出那个地址的,你看看是什么 |
就是那个值啊 |
我才发现。。对于动车,是用不了的,,= = |
动车可以加 |
C:\Users\a7822\Downloads\node_12306-master>node main.js
? 输入日期-time(如:2017-01-27): 2017-02-11
? 输入始发站拼音-from_station(如:shanghai): guangzhou
? 你选哪一个车站? 广州
? 输入终点站拼音-end_station(如:hefei): pingnanan (没有这个车站哦,请重新输入)
? 输入终点站拼音-end_station(如:hefei): pingnannan
? 你选哪一个车站? 平南南
? 输入车次-train_num(如:K1209,多个车次用|分开): D3786
? 输入邮箱-your_mail(如:[email protected]): [email protected]
? 输入密码或者邮箱授权码-mail_pass: [hidden]
? 是否购买学生票?(y/n): No
? 输入收件人邮箱(如果与上面的邮箱一致请直接回车):
(node:840072) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
leftTicket/query
C:\Users\a7822\Downloads\node_12306-master\main.js:251
for (var cr = 0; cr < ct.length; cr++) {
^
TypeError: Cannot read property 'length' of undefined
at b4 (C:\Users\a7822\Downloads\node_12306-master\main.js:251:28)
at IncomingMessage. (C:\Users\a7822\Downloads\node_12306-master\main.js:330:15)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
The text was updated successfully, but these errors were encountered: