一,准备条件。

1,网银。

2,IE浏览器,必备。我用得时工行网银,工行就只认ie,没办法。

3,chrome浏览器。可选。这个浏览器可以方便的选择你想要的席别。

二,步骤。以使用chrome浏览器刷票,使用ie浏览器支付为例(本人就是这么搞的)

说明:之所以使用chrome浏览器,就本人体验来讲,选择席别比较靠谱。您可以使用一个账号在ie和chrome同时登陆,这样避免了顶上票后无法支付带来的眼睁睁看他溜走的懊恼。本人是有切肤之痛。

1,chrome浏览器安装插件。

/**  12306 Auto Query => A javascript snippet to help you book tickets online.*  12306 Booking Assistant*  Copyright (C) 2011 Hidden* *  12306 Auto Query => A javascript snippet to help you book tickets online.*  Copyright (C) 2011 Jingqin Lynn* *  12306 Auto Login => A javascript snippet to help you auto login 12306.com.*  Copyright (C) 2011 Kevintop* *  Includes jQuery*  Copyright 2011, John Resig*  Dual licensed under the MIT or GPL Version 2 licenses.*  http://jquery.org/license* *  This program is free software: you can redistribute it and/or modify*  it under the terms of the GNU General Public License as published by*  the Free Software Foundation, either version 3 of the License, or*  (at your option) any later version.* *  This program is distributed in the hope that it will be useful,*  but WITHOUT ANY WARRANTY; without even the implied warranty of*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*  GNU General Public License for more details.* *  You should have received a copy of the GNU General Public License*  along with this program.  If not, see <http://www.gnu.org/licenses/>.* */// ==UserScript==
// @name         12306 Booking Assistant
// @version         1.3.1
// @author       zzdhidden@gmail.com
// @namespace    https://github.com/zzdhidden
// @description  12306 订票助手之(自动登录,自动查票,自动订单)
// @include      *://dynamic.12306.cn/otsweb/loginAction.do*
// @include         *://dynamic.12306.cn/otsweb/order/querySingleAction.do*
// @include         *://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do*
// @require    https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// ==/UserScript== function withjQuery(callback, safe){if(typeof(jQuery) == "undefined") {var script = document.createElement("script");script.type = "text/javascript";script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";if(safe) {var cb = document.createElement("script");cb.type = "text/javascript";cb.textContent = "jQuery.noConflict();(" + callback.toString() + ")(jQuery);";script.addEventListener('load', function() {document.head.appendChild(cb);});}else {var dollar = undefined;if(typeof($) != "undefined") dollar = $;script.addEventListener('load', function() {jQuery.noConflict();$ = dollar;callback(jQuery);});}document.head.appendChild(script);} else {callback(jQuery);}
}withjQuery(function($){$(document).click(function() {if( window.webkitNotifications && window.webkitNotifications.checkPermission() != 0 ) {window.webkitNotifications.requestPermission();}});function notify(str, timeout, skipAlert) {if( window.webkitNotifications && window.webkitNotifications.checkPermission() == 0 ) {var notification = webkitNotifications.createNotification("http://www.12306.cn/mormhweb/images/favicon.ico",  // icon url - can be relative'订票',  // notification titlestr);notification.show();if ( timeout ) {setTimeout(function() {notification.cancel();}, timeout);}return true;} else {if( !skipAlert ) {alert( str );}return false;}}function route(match, fn) {if( window.location.href.indexOf(match) != -1 ) {fn();};}route("querySingleAction.do", function() {//queryvar isTicketAvailable = false;//The table for displaying ticketsvar tbl = $(".obj")[0];if( tbl.addEventListener ) {// Not work on IEtbl.addEventListener("DOMNodeInserted", function() {if(checkTickets(event.target)){isTicketAvailable = true;highLightRow(event.target);}tbl.firstAppend=false;}, true);} else {window.$ && window.$(tbl).ajaxComplete(function() {$(this).find("tr").each(function(n, e) {if(checkTickets(e)){isTicketAvailable = true;highLightRow(e);}   });if(g.firstRemove) {g.firstRemove = false;if (isTicketAvailable) {if (isAutoQueryEnabled)document.getElementById("refreshButton").click();onticketAvailable(); //report}else {//wait for the button to become valid}}});}//Trigger the buttonvar doQuery = function() {displayQueryTimes(queryTimes++);tbl.firstAppend = true;g.firstRemove = true;document.getElementById(isStudentTicket ? "stu_submitQuery" : "submitQuery").click();}var checkTickets = function(row) {var hasTicket = false;var canBook = true;$("td input[type=button]", row).each(function(i, e) {if($(e).hasClass("yuding_x")) {canBook = false;}});if(!canBook) return false;$("td", row).each(function(i, e) {if(ticketType[i-1]) {var info = $.trim($(e).text());if(info != "--" && info != "无") {hasTicket = true;highLightCell(e);}}});return hasTicket;}//The box into which the message is inserted.var g = document.getElementById("gridbox");//When the message is removed, the query should be completed.if( g.addEventListener ) {g.addEventListener("DOMNodeRemoved", function() {if(g.firstRemove) {g.firstRemove = false;if (isTicketAvailable) {if (isAutoQueryEnabled)document.getElementById("refreshButton").click();onticketAvailable(); //report}else {//wait for the button to become valid}}}, true);}//hack into the validQueryButton function to detect queryvar _validQueryButton = validQueryButton;validQueryButton = function() {_validQueryButton();if(isAutoQueryEnabled) doQuery();}var queryTimes = 0; //countervar isAutoQueryEnabled = false; //enable flag//please DIY:var audio = null;var onticketAvailable = function() {if(window.Audio) {if(!audio) {audio = new Audio("http://www.w3school.com.cn/i/song.ogg");audio.loop = true;}audio.play();notify("可以订票了!", null, true);} else {notify("可以订票了!");}}var highLightRow = function(row) {$(row).css("background-color", "red");}var highLightCell = function(cell) {$(cell).css("background-color", "blue");}var displayQueryTimes = function(n) {document.getElementById("refreshTimes").innerText = n;};var isStudentTicket = false;//Control panel UIvar ui = $("<div>请先选择好出发地,目的地,和出发时间。   </div>").append($("<input id='isStudentTicket' type='checkbox' />").change(function(){isStudentTicket = this.checked;})).append($("<label for='isStudentTicket'></label>").html("学生票  ")).append($("<button style='padding: 5px 10px; background: #2CC03E;border-color: #259A33;border-right-color: #2CC03E;border-bottom-color:#2CC03E;color: white;border-radius: 5px;text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.2);'/>").attr("id", "refreshButton").html("开始刷票").click(function() {if(!isAutoQueryEnabled) {isTicketAvailable = false;if(audio && !audio.paused) audio.pause();isAutoQueryEnabled = true;doQuery();this.innerText="停止刷票";}else {isAutoQueryEnabled = false;this.innerText="开始刷票";}})).append($("<span>").html("  尝试次数:").append($("<span/>").attr("id", "refreshTimes").text("0"))).append( //Custom ticket type$("<div>如果只需要刷特定的票种,请在余票信息下面勾选。</div>").append($("<a href='#' style='color: blue;'>只勾选坐票  </a>").click(function() {$(".hdr tr:eq(2) td").each(function(i,e) {$(this).find("input").attr("checked", $(this).text().indexOf("座") != -1 ).change();});return false;})).append($("<a href='#' style='color: blue;'>只勾选卧铺  </a>").click(function() {$(".hdr tr:eq(2) td").each(function(i,e) {$(this).find("input").attr("checked", $(this).text().indexOf("卧") != -1 ).change();});return false;})));var container = $(".cx_title_w:first");container.length ?ui.insertBefore(container) : ui.appendTo(document.body);//Ticket type selector & UIvar ticketType = new Array();$(".hdr tr:eq(2) td").each(function(i,e) {ticketType.push(false);if(i<3) return;ticketType[i] = true;var c = $("<input/>").attr("type", "checkBox").attr("checked", true);c[0].ticketTypeId = i;c.change(function() {ticketType[this.ticketTypeId] = this.checked;}).appendTo(e);});});route("loginAction.do?method=init", function() {if( !window.location.href.match( /init$/i ) ) {return;}//loginvar url = "https://dynamic.12306.cn/otsweb/loginAction.do?method=login";var queryurl = "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init";//Check had login, redirect to query urlif( parent && parent.$ ) {var str = parent.$("#username_ a").attr("href");if( str && str.indexOf("sysuser/user_info") != -1 ){window.location.href = queryurl;return;}}function submitForm(){var submitUrl = url;$.ajax({type: "POST",url: submitUrl,data: {"loginUser.user_name": $("#UserName").val(), "user.password": $("#password").val(), "randCode": $("#randCode").val()},timeout: 30000,//cache: false,//async: false,success: function(msg){if ( msg.indexOf('请输入正确的验证码') > -1 ) {alert('请输入正确的验证码!');}else if ( msg.indexOf('当前访问用户过多') > -1 || msg.match(/var\s+isLogin\s*=\s*false/i)) {//Fix: Issue #5reLogin();}else {notify('登录成功,开始查询车票吧!');window.location.replace( queryurl );};},error: function(msg){reLogin();},beforeSend: function(XHR){//alert("Data Saved: " + XHR);}});}var count = 1;function reLogin(){count ++;$('#refreshButton').html("("+count+")次登录中...");setTimeout(submitForm, 2000);}//初始化$("#subLink").after($("<a href='#' style='padding: 5px 10px; background: #2CC03E;border-color: #259A33;border-right-color: #2CC03E;border-bottom-color:#2CC03E;color: white;border-radius: 5px;text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.2);'/>").attr("id", "refreshButton").html("自动登录").click(function() {count = 1;$(this).html("(1)次登录中...");//notify('开始尝试登录,请耐心等待!', 4000);submitForm();return false;}));alert('如果使用自动登录功能,请输入用户名、密码及验证码后,点击自动登录,系统会尝试登录,直至成功!');});route("confirmPassengerAction.do", function() {/*** Auto Submit Order* From: https://gist.github.com/1577671* Author: kevintop@gmail.com  *///Auto select the first user when not selectedif( !$("input._checkbox_class:checked").length ) {try{//Will failed in IE$("input._checkbox_class:first").click();}catch(e){};}//passengerTicketsvar userInfoUrl = 'https://dynamic.12306.cn/otsweb/order/myOrderAction.do?method=queryMyOrderNotComplete&leftmenu=Y';var count = 1;function submitForm(){if(window.submit_form_check && !submit_form_check("confirmPassenger") ) {return;}jQuery.ajax({url: $("#confirmPassenger").attr('action'),data: $('#confirmPassenger').serialize(),type: "POST",timeout: 30000,success: function(msg){//Refresh tokenvar match = msg && msg.match(/org\.apache\.struts\.taglib\.html\.TOKEN['"]?\s*value=['"]?([^'">]+)/i);var newToken = match && match[1];if(newToken) {$("input[name='org.apache.struts.taglib.html.TOKEN']").val(newToken);}if( msg.indexOf('payButton') > -1 ) {//Success!notify("车票预订成功,恭喜!");window.location.replace(userInfoUrl);return;}var reTryMessage = ['用户过多', '确认客票的状态后再尝试后续操作',  '请不要重复提交'];for (var i = reTryMessage.length - 1; i >= 0; i--) {if( msg.indexOf( reTryMessage[i] ) > -1 ) {reSubmitForm();return;}};//Parse error messagemsg = msg.match(/var\s+message\s*=\s*"([^"]*)/);stop(msg && msg[1] || '出错了。。。。 啥错? 我也不知道。。。。。');},error: function(msg){reSubmitForm();}});};function reSubmitForm(){count ++;$('#refreshButton').html("("+count+")次自动提交中...");setTimeout(submitForm, 500);}function stop ( msg ) {$('#refreshButton').html("自动提交订单");alert( msg );}//初始化if($("#refreshButton").size()<1){$(".tj_btn").append($("<a style='padding: 5px 10px; background: #2CC03E;border-color: #259A33;border-right-color: #2CC03E;border-bottom-color:#2CC03E;color: white;border-radius: 5px;text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.2);'></a>").attr("id", "refreshButton").html("自动提交订单").click(function() {//alert('开始自动提交订单,请点确定后耐心等待!');count = 1;$(this).html("(1)次自动提交中...");submitForm();return false;}));alert('如果使用自动提交订单功能,请在确认订单正确无误后,再点击自动提交按钮!');}});
}, true);

把以上内容存到名为“12306BookingAssistant.user.js”的文件中,把该文件拖到chrome浏览器中,左下角出现,点击继续就可以安装了。

2,地址栏输入 www.12306.cn ,然后进入 车票预订 页面,登陆的时候输入用户名和密码后,点击 “自动登陆” ,就交给插件,帮你不厌其烦的登陆。此时,需要耐心等待,等多久?就看人品了。登陆成功后,桌面右下角会给出提示。

3,现在就可以真正进入车票预订页了。输入你梦想已久的车票信息,点击页面中间大大的 “开始刷票”你就可以继续等待了。插件帮你查到有票后,会再次提示您。

4,进入订票时候,还会有一个大大大的 自动提交订单 按钮,帮您提交。不好意思,还得耐心等候,如果人品好,插件会再次提醒您,订票成功。

别激动,到这一步,万里长征才渡过金沙江,还有草地和雪山。下面是进入网银支付。

5,下载trixiesetup.msi安装。http://www.bhelpuri.net/Trixie/TrixieDownload.htm

6,把上面的js代码““12306BookingAssistant.user.js” 拷贝到trixie的安装目录下,我的是默认路径“C:\Program Files\Bhelpuri\Trixie\Scripts”。现在就在ie上用插件了。

7,在ie浏览器中进入 电子商务网站的新秀 www.12306.cn,同样的方法,登陆,查询订单,然后支付。

祝您订票顺利,一路顺风。

PS:经本人实际使用经历,用工行的网银还是使用IE靠谱,用了360极速浏览器工行网银链接失败。

道高一尺 魔高一丈(使用插件订火车票)相关推荐

  1. 如何让开源多点成功的几率;开源和 COVID-19: 道高一尺魔高一丈;等开源之道每周评论2020 04 07...

    ▼ 更多精彩推荐,请关注我们 ▼ 声明:本文所言论,仅代表适兕个人观点 文章评论 避免边缘化:开源软件如何成功? 原文链接:Avoiding the ragged edge: How open-sou ...

  2. firefox用12306Helper 0.2结合ie tab+自动订火车票和完成支付全攻略

    firefox用12306Helper 0.2结合ie tab+自动订火车票和完成支付全攻略 今天顶天在网上发现一个很好用的firefox插件12306Helper,很好用,但是定完票后不能支付,原因 ...

  3. 12306网上订火车票很快呀

    又是一年,因为女朋友是济宁的,所以年底订火车票成了我的任务,以前是排队买票,自能从12306网上订火车票后,前后几次都是在上面订的,不用排队,网银支付,方便! 12306虽然不是常用,不过订的这几次, ...

  4. vlan的端口隔离及端口优化——“道高一尺魔高一丈”

    "道高一尺魔高一丈"-vlan的端口隔离及端口优化 目录:端口隔离及优化实验操作与总结 "道高一尺魔高一丈"-vlan的端口隔离及端口优化 端口隔离-制定ACL ...

  5. 使用百度UNIT搭建智能对话系统_订火车票实例

    今天我们来一个没有代码的教程,无需编程基础也能学会搭建智能对话系统,在学习之前,我们先来了解一下对话系统的专业术语: 单轮对话:简单的一问一答,问题可以用一句话来描述,不依赖于上下文 召回率:机器人能 ...

  6. 从网上订火车票的网站12306.cn谈谈网站性能技术

    从网上订火车票的网站12306.cn谈谈网站性能技术 12306.cn网站挂了,被全国人民骂了.我这两天也在思考这个事,我想以这个事来粗略地和大家讨论一下网站性能的问题.因为仓促,而且完全基于 本人有 ...

  7. 网站有反爬机制就爬不了数据?那是你不会【反】反爬!道高一尺魔高一丈啊!

    不知道你们在用爬虫爬数据的时候是否有发现,越来越多的网站都有自己的反爬机制,抓取数据已经不像以前那么容易,目前常见的反爬机制主要有以下几种: 数据是通过动态加载的,比如微博,今日头条,b站 需要登录, ...

  8. 2014春运直通车:12306网上订火车票全攻略

    2014春运直通车:12306网上订火车票全攻略 2014年春运正式吹响了号角,最火的网站非12306莫属了.此时的你是否在为买票而犯愁?是否担心在春运途中会再次上演现场版的"人在囧途&qu ...

  9. linux 火车票软件,快订火车票软件下载-快订火车票订购appv3.3.5-Linux公社

    快订火车票是一款非常专业的车票订购软件,用户可以在这里快速的查询车票和机票情况,进行抢购,当然价格也会更便宜,如果有任何问题,也可以联系客服为你解决购票问题,非常贴心的服务,快订火车票app中不仅可以 ...

最新文章

  1. 一些关键字表明变量属性值
  2. XPsp3键盘设备链/栈信息_02_VMware
  3. python基本用法_python基本用法
  4. vs2010项目属性配置
  5. php常用功能代码,10段PHP常用功能代码(1)_PHP教程
  6. 两个相邻盒子的边框怎么只显示一个_【前端小课堂】0044 盒子
  7. 2.mysql数据库如何安装_MySQL数据库如何安装
  8. ssm配置文件引用细节
  9. 【洛谷】P1111 修复公路
  10. Mac使用minicom串口工具
  11. 【计算方法】牛顿插值法
  12. 学习opencv3 pdf_PDF的虚拟打印机,免费又好用
  13. vmware虚拟机桥接模式无法上网
  14. Linux下C语言开发通讯录管理软件(一)
  15. 哪种销售方式更能深入人心?
  16. win10更改了用户名后远程登录还要用原来的用户名怎么修改
  17. S@Kura的PHP进阶之路(二)
  18. matplotlib绘制饼图
  19. HGOI 20190821 慈溪一中互测
  20. python学习-06(模块化编程)

热门文章

  1. 怎么查服务器域名 mac系统,苹果6s肿么查看服务器域名
  2. 让面试官哑口无言的JS奇葩知识,你遇到过吗?
  3. 树莓派4初次使用笔记(Pi OS ROS Kinetic安装)
  4. B15 - 999、大数据组件学习⑫ - Hue
  5. 对bam文件作基础统计
  6. 财务大数据比赛代码例子
  7. 电脑如何录制在线课程?-QVE屏幕录制
  8. 绿皮车里的温馨服务 情暖回家路
  9. flutter 语音转文字(科大讯飞)
  10. Unity内动态影子的各种做法