1.来自12306的火车车次数据
使用12306网站的接口,查询余票。此接口采集自 这里。 全国火车站代号字典,下载
。
火车票余票查询
http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=queryLeftTicket&orderRequest.train_date=2013-10-08&orderRequest.from_station_telecode=BJP&orderRequest.to_station_telecode=SHH&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00:00--24:00
你测试该地址时,请修改日期查询
上面的地址返回的数据格式如下:
{"datas":"0,G101<\/span>, 北京南
07:00, 上海虹桥
12:36,05:36,26,--,59,200,--,--,--,--,--,--,--,\\n1,G11<\/span>, 北京南
08:00, 上海虹桥
13:09,05:09,12,--,63,593,--,--,--,--,--,--,--,\\n2,G107<\/span>, 北京南
08:08, 上海虹桥
13:39,05:31,13,--,60,94,--,--,--,--,--,--,--,\\n3,D315<\/span>, 北京南
08:18, 上海虹桥
17:33,09:15,--,--,--,无<\/font>,--,--,--,--,--,19,--,\\n4,G1<\/span>, 北京南
09:00, 上海虹桥
13:48,04:48,24,--,101,526,--,--,--,--,--,--,--,\\n5,G113<\/span>, 北京南
09:05, 上海虹桥
14:29,05:24,20,--,108,43,--,--,--,--,--,--,--,\\n6,G115<\/span>, 北京南
09:16, 上海虹桥
14:48,05:32,26,--,79,261,--,--,--,--,--,--,--,\\n7,G41<\/span>, 北京南
09:33, 上海虹桥
15:08,05:35,22,--,89,15,--,--,--,--,--,--,--,\\n8,D317<\/span>, 北京南
09:38, 上海虹桥
18:28,08:50,--,--,--,147,--,3,--,--,--,51,--,\\n9,G13<\/span>, 北京南
10:00, 上海虹桥
14:55,04:55,26,--,107,369,--,--,--,--,--,--,--,\\n10,G117<\/span>, 北京南
10:05, 上海虹桥
15:29,05:24,--,10,56,60,--,--,--,--,--,--,--,\\n11,G119<\/span>, 北京南
10:45, 上海虹桥
16:19,05:34,8,--,68,87,--,--,--,--,--,--,--,\\n12,G15<\/span>, 北京南
11:00, 上海虹桥
15:55,04:55,12,--,67,300,--,--,--,--,--,--,--,\\n13,G121<\/span>, 北京南
11:05, 上海虹桥
16:42,05:37,13,--,70,156,--,--,--,--,--,--,--,\\n14,G125<\/span>, 北京南
11:35, 上海虹桥
17:13,05:38,--,10,62,106,--,--,--,--,--,--,--,\\n15,D319<\/span>, 北京南
11:40, 上海虹桥
20:52,09:12,--,--,无<\/font>,61,--,--,--,--,--,75,--,\\n16,1461<\/span>, 北京
11:58, 上海
08:08,20:10,--,--,--,--,--,--,无<\/font>,--,1084,254,--,\\n17,G129<\/span>, 北京南
12:04, 上海虹桥
17:41,05:37,23,--,91,229,--,--,--,--,--,--,--,\\n18,G131<\/span>, 北京南
12:28, 上海虹桥
18:04,05:36,13,--,74,195,--,--,--,--,--,--,--,\\n19,G133<\/span>, 北京南
12:49, 上海虹桥
18:18,05:29,25,--,113,200,--,--,--,--,--,--,--,\\n20,G135<\/span>, 北京南
13:07, 上海虹桥
18:44,05:37,25,--,84,173,--,--,--,--,--,--,--,\\n21,G3<\/span>, 北京南
14:00, 上海虹桥
18:48,04:48,24,--,106,401,--,--,--,--,--,--,--,\\n22,G43<\/span>, 北京南
14:05, 上海虹桥
19:34,05:29,20,--,82,51,--,--,--,--,--,--,--,\\n23,G139<\/span>, 北京南
14:16, 上海虹桥
19:47,05:31,25,--,118,269,--,--,--,--,--,--,--,\\n24,G141<\/span>, 北京南
14:22, 上海虹桥
19:55,05:33,26,--,116,474,--,--,--,--,--,--,--,\\n25,G143<\/span>, 北京南
14:43, 上海虹桥
20:27,05:44,26,--,121,572,--,--,--,--,--,--,--,\\n26,G17<\/span>, 北京南
15:00, 上海虹桥
19:59,04:59,25,--,104,562,--,--,--,--,--,--,--,\\n27,G145<\/span>, 北京南
15:29, 上海虹桥
21:07,05:38,13,--,79,595,--,--,--,--,--,--,--,\\n28,G19<\/span>, 北京南
16:00, 上海虹桥
21:12,05:12,24,--,101,565,--,--,--,--,--,--,--,\\n29,G147<\/span>, 北京南
16:10, 上海虹桥
21:42,05:32,2,--,27,586,--,--,--,--,--,--,--,\\n30,G21<\/span>, 北京南
17:00, 上海虹桥
22:29,05:29,26,--,115,523,--,--,--,--,--,--,--,\\n31,G153<\/span>, 北京南
17:05, 上海虹桥
22:42,05:37,26,--,121,667,--,--,--,--,--,--,--,\\n32,G157<\/span>, 北京南
17:32, 上海虹桥
22:59,05:27,13,--,80,763,--,--,--,--,--,--,--,\\n33,T109<\/span>, 北京
19:33, 上海
09:55,14:22,--,--,--,--,12,无<\/font>,无<\/font>,--,无<\/font>,123,--,\\n34,D313<\/span>, 北京南
19:34, 上海
07:15,11:41,--,--,--,69,无<\/font>,301,--,--,--,无<\/font>,--,\\n35,D311<\/span>, 北京南
21:16, 上海
08:58,11:42,--,--,--,239,--,258,--,--,--,12,--,\\n36,D321<\/span>, 北京南
21:22, 上海
09:04,11:42,--,--,--,287,--,239,--,--,--,12,--,","time":"13:40"}
得到上面的JSON数据,你只需要出来一下,该接口你就可以为你所用了。
查询某天的所有列车车次
包含列车的名称,发车时间和到车时间以及始发站和终点站
http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=queryststrainall&date=2013-9-19&fromstation=BJP&tostation=SHH&starttime=00:00--24:00
同样,你测试需要看看日期是否过时,是否是你想查的日期
返回的数据格式如下:
[{"end_station_name":"上海虹桥","end_time":"12:36","id":"240000G10103","start_station_name":"北京南","start_time":"07:00","value":"G101"},{"end_station_name":"上海虹桥","end_time":"13:09","id":"2400000G1106","start_station_name":"北京南","start_time":"08:00","value":"G11"},{"end_station_name":"上海虹桥","end_time":"13:39","id":"240000G10707","start_station_name":"北京南","start_time":"08:08","value":"G107"},{"end_station_name":"上海虹桥","end_time":"17:33","id":"240000D31509","start_station_name":"北京南","start_time":"08:18","value":"D315"},{"end_station_name":"上海虹桥","end_time":"14:13","id":"240000G10904","start_station_name":"北京南","start_time":"08:35","value":"G109"},{"end_station_name":"上海虹桥","end_time":"13:48","id":"24000000G106","start_station_name":"北京南","start_time":"09:00","value":"G1"},{"end_station_name":"上海虹桥","end_time":"14:29","id":"240000G11305","start_station_name":"北京南","start_time":"09:05","value":"G113"},{"end_station_name":"上海虹桥","end_time":"14:48","id":"240000G1150H","start_station_name":"北京南","start_time":"09:16","value":"G115"},{"end_station_name":"杭州","end_time":"16:17","id":"2400000G4102","start_station_name":"北京南","start_time":"09:33","value":"G41"},{"end_station_name":"上海虹桥","end_time":"18:28","id":"240000D31708","start_station_name":"北京南","start_time":"09:38","value":"D317"},{"end_station_name":"上海虹桥","end_time":"14:55","id":"2400000G1301","start_station_name":"北京南","start_time":"10:00","value":"G13"},{"end_station_name":"上海虹桥","end_time":"15:29","id":"240000G11700","start_station_name":"北京南","start_time":"10:05","value":"G117"},{"end_station_name":"上海虹桥","end_time":"16:19","id":"240000G11904","start_station_name":"北京南","start_time":"10:45","value":"G119"},{"end_station_name":"上海虹桥","end_time":"15:55","id":"2400000G1505","start_station_name":"北京南","start_time":"11:00","value":"G15"},{"end_station_name":"上海虹桥","end_time":"16:42","id":"240000G12106","start_station_name":"北京南","start_time":"11:05","value":"G121"},{"end_station_name":"上海虹桥","end_time":"17:13","id":"240000G1250J","start_station_name":"北京南","start_time":"11:35","value":"G125"},{"end_station_name":"上海虹桥","end_time":"20:52","id":"240000D31907","start_station_name":"北京南","start_time":"11:40","value":"D319"},{"end_station_name":"上海","end_time":"08:08","id":"24000014610T","start_station_name":"北京","start_time":"11:58","value":"1461"},{"end_station_name":"上海虹桥","end_time":"17:41","id":"240000G1290F","start_station_name":"北京南","start_time":"12:04","value":"G129"},{"end_station_name":"上海虹桥","end_time":"18:04","id":"240000G13105","start_station_name":"北京南","start_time":"12:28","value":"G131"},{"end_station_name":"上海虹桥","end_time":"18:18","id":"240000G13300","start_station_name":"北京南","start_time":"12:49","value":"G133"},{"end_station_name":"上海虹桥","end_time":"18:44","id":"240000G13503","start_station_name":"北京南","start_time":"13:07","value":"G135"},{"end_station_name":"上海虹桥","end_time":"18:48","id":"24000000G304","start_station_name":"北京南","start_time":"14:00","value":"G3"},{"end_station_name":"杭州东","end_time":"20:39","id":"2400000G4310","start_station_name":"北京南","start_time":"14:05","value":"G43"},{"end_station_name":"上海虹桥","end_time":"19:47","id":"240000G1390A","start_station_name":"北京南","start_time":"14:16","value":"G139"},{"end_station_name":"上海虹桥","end_time":"19:55","id":"240000G14103","start_station_name":"北京南","start_time":"14:22","value":"G141"},{"end_station_name":"上海虹桥","end_time":"20:27","id":"240000G1430A","start_station_name":"北京南","start_time":"14:43","value":"G143"},{"end_station_name":"上海虹桥","end_time":"19:59","id":"2400000G1705","start_station_name":"北京南","start_time":"15:00","value":"G17"},{"end_station_name":"上海虹桥","end_time":"21:07","id":"240000G1450A","start_station_name":"北京南","start_time":"15:29","value":"G145"},{"end_station_name":"上海虹桥","end_time":"21:42","id":"240000G14704","start_station_name":"北京南","start_time":"16:10","value":"G147"},{"end_station_name":"上海虹桥","end_time":"22:29","id":"2400000G2103","start_station_name":"北京南","start_time":"17:00","value":"G21"},{"end_station_name":"上海虹桥","end_time":"22:42","id":"240000G15304","start_station_name":"北京南","start_time":"17:05","value":"G153"},{"end_station_name":"上海虹桥","end_time":"22:59","id":"240000G15706","start_station_name":"北京南","start_time":"17:32","value":"G157"},{"end_station_name":"上海","end_time":"09:55","id":"240000T1090G","start_station_name":"北京","start_time":"19:33","value":"T109"},{"end_station_name":"上海","end_time":"07:15","id":"240000D31308","start_station_name":"北京南","start_time":"19:34","value":"D313"},{"end_station_name":"上海","end_time":"08:58","id":"240000D31110","start_station_name":"北京南","start_time":"21:16","value":"D311"},{"end_station_name":"上海","end_time":"09:04","id":"240000D32120","start_station_name":"北京南","start_time":"21:22","value":"D321"}]
2.来自新浪应用的接口数据
请注明数据来源:铁路客户服务中心 http://www.12306.cn/ 请支持友情链接:http://chepiao.sinaapp.com **********************************************************************************************说明:全部使用POST提交数据, 返回JSON字符串. 接口地址:http://chepiao.sinaapp.com/api.php. 测试地址:http://chepiao.sinaapp.com/api.php?act=remain&startStation=%E4%B8%8A%E6%B5%B7&arriveStation=%E5%8C%97%E4%BA%AC&date=2012-01-01----------------------------------------------------------------------------------------------
1. 余票&票价查询:
Url: http://chepiao.sinaapp.com/api.php?act=remainPost: date: [yyyy-mm-dd OR yyyy/mm/dd OR yyyymmdd]startStation: 发站[中文 UTF8]arriveStation: 到站[中文 UTF8]Json:title: 信息标题station: 车站信息item: 车次信息列表trainCode: 序号trainCode: 车次startStation: 发站arriveStation: 到站startTime: 发时endTime: 到时takeTime: 历时mileage: 里程hard-seat: 硬座(余票)soft-seat: 软座(余票)hard-sleeper1: 硬卧上(余票)hard-sleeper2: 硬卧中(余票)hard-sleeper3: 硬卧下(余票)soft-sleeper1: 软卧上(余票)soft-sleeper2: 软卧下(余票)best-seat: 特等座(余票)one-seat: 一等座(余票)two-seat: 二等座(余票)vag-sleeper1: 高级软卧上(余票)vag-sleeper2: 高级软卧下(余票)none-seat: 无座(余票)hard-seat-prc: 硬座(价格)soft-seat-prc: 软座(价格)hard-sleeper1-prc: 硬卧上(价格)hard-sleeper2-prc: 硬卧中(价格)hard-sleeper3-prc: 硬卧下(价格)soft-sleeper1-prc: 软卧上(价格)soft-sleeper2-prc: 软卧下(价格)one-seat-prc: 一等座(价格)two-seat-prc: 二等座(价格)vag-sleeper1-prc: 高级软卧上(价格)vag-sleeper2-prc: 高级软卧下(价格)trainGrade: 等级----------------------------------------------------------------------------------------------
2. 车次查询:
Url: http://chepiao.sinaapp.com/api.php?act=codePost: trainCode: 车次[字母+数字]Json:title: 信息标题head: 头部标题item: 车次信息----------------------------------------------------------------------------------------------
3. 车站查询:
Url: http://chepiao.sinaapp.com/api.php?act=stationPost: stationName: 发站[中文 UTF8]Json:title: 信息标题station: 车站信息item: 车次信息列表trainCode: 车次trainGrade: 等级fromStation: 始发站fromStime: 始发时间toStation: 终到站toStime: 终到时间takeTime: 历时mileage: 里程stationName: 车站--------------------------------------------------------------------------------------------------
4. 正晚点查询:
Url: http://chepiao.sinaapp.com/api.php?act=schedulePost: stationName: 车站[中文 UTF8]trainCode: 车次[字母+数字]stationType: 类型[0:到达 1:出发]Json:title: 查询到的正晚点信息 --------------------------------------------------------------------------------------------------
5. 机票查询
Url: http://chepiao.sinaapp.com/api.php?act=planePost: date: [yyyy-mm-dd OR yyyy/mm/dd OR yyyymmdd]departureAirport: 起飞[中文 UTF8]arrivalAirport: 到达[中文 UTF8]Json:title: 信息标题item: 信息列表flightCode: 航班号carrierCom: 航空公司planeType: 机型departureTime: 起飞时间arrivalTime: 降落时间costTime: 飞行时间departureAirport: 起飞机场arrivalAirport: 降落机场correctness: 准点率 delay: 平均延时
本文链接:https://my.lmcjl.com/post/16427.html
4 评论