当前位置:   article > 正文

大麦抢票脚本_大麦网抢票外挂

大麦网抢票外挂

大麦抢票脚本-记得安装脚本软件

Chrome:Tampermonkey 或 Violent monkey

Firefox:GreasemonkeyTampermonkey

1.选中场次票价,登录填好收货信息

  1. // ==UserScript==
  2. // @name 大麦抢票-选场次票价人数
  3. // @namespace https://www.jwang0614.top/scripts
  4. // @version 0.6
  5. // @description 辅助购买大麦网演唱会门票
  6. // @author Olivia Wang
  7. // @match https://detail.damai.cn/*
  8. // @grant none
  9. // ==/UserScript==
  10. (function() {
  11. //'use strict';
  12. // Your code here...
  13. if(!window.localStorage){
  14. alert('不支持这个浏览器,请换成Chrome或者Safari。');
  15. return null;
  16. }
  17. /**** 改人数 ***/
  18. var people_num = 1;
  19. var storage = window.localStorage;
  20. storage.setItem("people_num", people_num);
  21. //storage.clear();
  22. var start = document.createElement("P");
  23. start.appendChild(document.createTextNode("开始抢票 (ctrl+E)"));
  24. start.style.lineheight="50px";
  25. start.style.color="white";
  26. start.style.fontSize="30px";
  27. start.style.padding="10px 20px";
  28. start.style.background="green";
  29. start.style.position="fixed";
  30. start.style.right="30px";
  31. start.style.top="100px";
  32. start.style.zIndex="10000";
  33. var stop = document.createElement("P");
  34. stop.appendChild(document.createTextNode("停止抢票 (ctrl+T)"));
  35. stop.style.lineheight="50px";
  36. stop.style.color="white";
  37. stop.style.fontSize="30px";
  38. stop.style.padding="10px 20px";
  39. stop.style.background="black";
  40. stop.style.position="fixed";
  41. stop.style.right="30px";
  42. stop.style.top="200px";
  43. stop.style.zIndex="10000";
  44. var notice = document.createElement("DIV");
  45. notice.style.color="white";
  46. notice.style.background="darkseagreen";
  47. notice.style.fontSize="20px";
  48. notice.style.padding="10px 20px";
  49. notice.style.position="fixed";
  50. notice.style.right="30px";
  51. notice.style.top="300px";
  52. notice.style.lineheight="30px";
  53. notice.style.zIndex = "10000";
  54. notice.style.width = "300px";
  55. var notice_0 = document.createElement("P");
  56. notice_0.appendChild(document.createTextNode("1.选择场次 2.选择价格 3.点击‘开始抢票’"));
  57. var notice_1 = document.createElement("P");
  58. notice_1.appendChild(document.createTextNode("当前选择人数:" + people_num + "人"));
  59. var notice_2 = document.createElement("P");
  60. notice_2.appendChild(document.createTextNode("如需改变请在脚本中修改people_num变量"));
  61. var notice_3 = document.createElement("P");
  62. notice_3.appendChild(document.createTextNode("请先登录,填写一个默认地址,输入"+ people_num+"个购票人"));
  63. var notice_4 = document.createElement("P");
  64. notice_4.appendChild(document.createTextNode("不支持选座"));
  65. var notice_5 = document.createElement("P");
  66. notice_5.appendChild(document.createTextNode("如果不是快递票不要忘了修改另一个脚本中姓名(contact)和电话(phone)的值。"));
  67. notice_0.style.color = "white";
  68. notice_0.style.background = "red";
  69. notice.appendChild(notice_0);
  70. notice.appendChild(notice_1);
  71. notice.appendChild(notice_2);
  72. notice_3.style.color = "red";
  73. notice_3.style.background = "white";
  74. notice.appendChild(notice_3);
  75. notice_4.style.color = "red";
  76. notice_4.style.background = "white";
  77. notice.appendChild(notice_4);
  78. notice_5.style.color = "white";
  79. notice_5.style.background = "red";
  80. notice.appendChild(notice_5);
  81. var container = document.querySelector('body');
  82. container.appendChild(start);
  83. container.appendChild(stop);
  84. container.appendChild(notice);
  85. reload_page();
  86. document.onkeydown = function() {
  87. var oEvent = window.event;
  88. if (oEvent.keyCode == 69 && oEvent.ctrlKey) {
  89. //alert("你按下了ctrl+E");
  90. // start
  91. start.click();
  92. }else if (oEvent.keyCode == 84 && oEvent.ctrlKey) {
  93. //alert("你按下了ctrl+T");
  94. // stop
  95. stop.click();
  96. }
  97. }
  98. function timedRefresh(timeoutPeriod) {
  99. window.setTimeout("location.reload(true);",timeoutPeriod);
  100. }
  101. start.onclick = function() {
  102. console.log('开始抢票!');
  103. //blinkStart();
  104. document.querySelector('body > div.perform').style.background="darksalmon";
  105. storage.setItem("isRunning", true);
  106. get_numbers_from_page();
  107. timedRefresh(400);
  108. };
  109. stop.onclick = function() {
  110. alert('停止抢票!');
  111. document.querySelector('body > div.perform').style.background="white";
  112. storage.setItem("isRunning", false);
  113. storage.removeItem("isRunning");
  114. storage.removeItem("price_ele_num");
  115. storage.removeItem("event_ele_num");
  116. storage.removeItem("people_num");
  117. storage.clear();
  118. };
  119. function sleep (time) {
  120. return new Promise((resolve) => setTimeout(resolve, time));
  121. }
  122. function set_up_check_page() {
  123. console.log("set up check page");
  124. var event_ele_num = storage.getItem("event_ele_num");
  125. var price_ele_num = storage.getItem("price_ele_num");
  126. var people_num = storage.getItem("people_num");
  127. if (storage.getItem("isRunning") == "true") {
  128. var perform_ele = document.querySelector('body > div.perform');
  129. if (perform_ele) {
  130. perform_ele.style.background="darksalmon";
  131. }
  132. }
  133. var event_selections = document.querySelectorAll('body > div.perform > div > div.flex1 > div.hd > div > div.order > div.perform__order__box > div.perform__order__select.perform__order__select__performs > div.select_right > .select_right_list > .select_right_list_item');
  134. event_selections[event_ele_num].click();
  135. console.log("event");
  136. sleep(200).then(() => {
  137. var price_selections = document.querySelectorAll('body > div.perform > div > div.flex1 > div.hd > div > div.order > div.perform__order__box > div.perform__desc__info + div > div.select_right > .select_right_list > .select_right_list_item');
  138. if (price_selections[price_ele_num]) {
  139. price_selections[price_ele_num].click();
  140. console.log("price");
  141. sleep(100).then(()=>{
  142. var people_selection = document.querySelector(".cafe-c-input-number-input");
  143. if (people_selection) {
  144. var people_inc_btn = document.querySelector('a.cafe-c-input-number-handler.cafe-c-input-number-handler-up');
  145. for (var i =1; i < people_num; i++) {
  146. people_inc_btn.click();
  147. console.log("inc");
  148. }
  149. sleep(50).then(()=>{
  150. var btn = document.querySelector("body > div.perform > div > div.flex1 > div.hd > div > div.order > div.perform__order__box > div:last-child > div");
  151. console.log(btn);
  152. if (btn) {
  153. if (btn.innerText == "立即购买" || btn.innerText == "立即预定") {
  154. storage.removeItem("isRunning");
  155. storage.removeItem("price_ele_num");
  156. storage.removeItem("event_ele_num");
  157. storage.removeItem("people_num");
  158. storage.clear();
  159. btn.click();
  160. }
  161. }
  162. });
  163. }
  164. if (storage.getItem("isRunning") == "true") {
  165. console.log("refreshing");
  166. timedRefresh(1000);
  167. }
  168. });
  169. } else {
  170. console.log("price_selections not found");
  171. timedRefresh(400);
  172. }
  173. });
  174. }
  175. function get_numbers_from_page() {
  176. var event_selections = document.querySelectorAll('body > div.perform > div > div.flex1 > div.hd > div > div.order > div.perform__order__box > div.perform__order__select.perform__order__select__performs > div.select_right > div > div');
  177. var price_selections = document.querySelectorAll('body > div.perform > div > div.flex1 > div.hd > div > div.order > div.perform__order__box > div.perform__desc__info + div > div.select_right > div > div');
  178. for (var i= 0;i < event_selections.length;i++) {
  179. if (event_selections[i].classList.contains("active")) {
  180. storage.setItem("event_ele_num", i);
  181. break;
  182. }
  183. }
  184. for (var j= 0;j < price_selections.length;j++) {
  185. if (price_selections[j].classList.contains("active")) {
  186. storage.setItem("price_ele_num", j);
  187. break;
  188. }
  189. }
  190. }
  191. function reload_page() {
  192. console.log("reload");
  193. //alert(storage.getItem("isRunning"));
  194. window.setTimeout(set_up_check_page,100);
  195. }
  196. })();

2.跳支付页面

  1. // ==UserScript==
  2. // @name 大麦抢票-确认
  3. // @namespace https://www.jwang0614.top/scripts
  4. // @version 0.5
  5. // @description 辅助购买大麦网演唱会门票
  6. // @author Olivia Wang
  7. // @match https://buy.damai.cn/orderConfirm*
  8. // @grant none
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. console.log("confirm");
  13. var audio = new Audio("http://audio.marsupialgurgle.com/audio/successtrumpet.mp3");
  14. //TODO 判断纸质票还是电子票
  15. var d_method = "express";
  16. var methods = ["electron","express", "self"];
  17. /** 修改配送方式,电子票index=0, 快递票index=1, 自助index=2**/
  18. // 默认快递票因为不需要再次填写信息
  19. var index = 1;
  20. /** 修改名字,电话号码**/
  21. var contact = "your_name";
  22. var phone = "your_phone_number";
  23. //等待10
  24. var wait_time = 10;
  25. var notice = document.createElement("DIV");
  26. notice.style.lineheight="30px";
  27. notice.style.color="white";
  28. notice.style.fontSize="18px";
  29. notice.style.padding="10px 20px";
  30. notice.style.background="green";
  31. notice.style.position="fixed";
  32. notice.style.left="30px";
  33. notice.style.top="100px";
  34. notice.style.zIndex="10000";
  35. var contact_p = document.createElement("P");
  36. contact_p.appendChild(document.createTextNode(contact));
  37. var phone_p = document.createElement("P");
  38. phone_p.appendChild(document.createTextNode(phone));
  39. notice.appendChild(contact_p);
  40. notice.appendChild(document.createElement("BR"));
  41. notice.appendChild(phone_p);
  42. var confirm = document.createElement("P");
  43. confirm.appendChild(document.createTextNode("确认订单"));
  44. confirm.style.lineheight="30px";
  45. confirm.style.color="white";
  46. confirm.style.fontSize="18px";
  47. confirm.style.padding="10px 20px";
  48. confirm.style.background="red";
  49. confirm.style.position="fixed";
  50. confirm.style.left="30px";
  51. confirm.style.top="200px";
  52. confirm.style.zIndex="10000";
  53. var container = document.querySelector('body');
  54. container.appendChild(notice);
  55. container.appendChild(confirm);
  56. var way_items = document.querySelectorAll(".way-item");
  57. if (way_items.length > 1) {
  58. var selector_str = ".way-item." + methods[index] + " > .way-image";
  59. var ele = document.querySelector(selector_str);
  60. if (ele) {
  61. ele.click();
  62. }
  63. }
  64. audio.play();
  65. var inputs = document.querySelectorAll(".delivery-form-row input");
  66. var persons = document.querySelectorAll('#confirmOrder_1 > div.dm-ticket-buyer > div.ticket-buyer-select > div.next-row.next-row-no-padding.buyer-list > div > label > span.next-checkbox.isFirefox > span');
  67. console.log(persons);
  68. if (persons.length !== 0) {
  69. for(var i = 0; i < persons.length; i++) {
  70. persons[i].click();
  71. }
  72. }
  73. if (inputs.length === 0) {
  74. // 不需要填写
  75. document.querySelector('#confirmOrder_1 > div.submit-wrapper > button').click();
  76. } else {
  77. // 等待用户输入姓名和电话
  78. sleep(wait_time * 1000).then(()=>{
  79. document.querySelector('#confirmOrder_1 > div.submit-wrapper > button').click();
  80. });
  81. }
  82. confirm.onclick = function(){
  83. this.style.background = "grey";
  84. document.querySelector('#confirmOrder_1 > div.submit-wrapper > button').click();
  85. };
  86. })();
  87. function sleep (time) {
  88. return new Promise((resolve) => setTimeout(resolve, time));
  89. }

                                        

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/524039
推荐阅读
相关标签
  

闽ICP备14008679号