Sleazy Fork is available in English.

115AV Helper

本脚本将在免登录115的状态下,在AVMOO、JAVBUS等片库网站中基于115实现一些额外功能(前提当然是你要有会员啦)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name 115AV Helper
  3. // @author kyay006
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.6
  6. // @description 本脚本将在免登录115的状态下,在AVMOO、JAVBUS等片库网站中基于115实现一些额外功能(前提当然是你要有会员啦)
  7. // @description 理论上只要页面看起来跟AVMOO、JAVBUS像,脚本就支持该网站,只需自行在下方参照格式添加一条match即可
  8. // @match http*://avmask.com/*
  9. // @match http*://avmoo.com/*
  10. // @match http*://avsox.asia/*
  11. // @match http*://www.javbus.com/*
  12. // @match http*://www.dmmbus.us/*
  13. // @match http*://www.dmmbus.work/*
  14. // @match http*://www.dmmsee.work/*
  15. // @match http*://www.busjav.us/*
  16. // @match http*://www.buscdn.work/*
  17. // @match http*://www.busdmm.work/*
  18. // @match http*://www.seedmm.us/*
  19. // @match http*://www.seedmm.in/*
  20. // @match http*://www.cdnbus.work/*
  21. // @match http*://www.cdnbus.icu/*
  22. // @domain 115.com
  23. // @domain btos.pw
  24. // @require https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
  25. // @grant GM_registerMenuCommand
  26. // @grant GM_xmlhttpRequest
  27. // @grant GM_notification
  28. // @grant GM_addStyle
  29. // ==/UserScript==
  30.  
  31. (function() {
  32. var cookie = "";//★★★使用前请先在双引号中填入你的115 Cookie★★★
  33.  
  34. var code,json;
  35. var site = {};
  36. var sites = {
  37. btspread:{
  38. result:[],//存放搜索结果
  39. getUrl:function (code){
  40. var url = "https://btsow.club/search/";
  41. return url + code;
  42. },
  43. matchResult:function (data){
  44. var magnet,name,date,size;
  45. var result;
  46. var nodes_regExp = /\<div class\=\"row\"\>([\s\S]*?)\<\/a\>/g;
  47. var node_regExp = /href\=\".*\/(\w+)\"\stitle\=\"(.*)\"[\s\S]*?Size\:([0-9KGMB.]+).*Date\:([0-9\-]+)/;
  48. var links = data.responseText.match(nodes_regExp);
  49. links.pop();//最后一个不是,去除
  50. if(links.length){
  51. $.each(links,function(key,val){
  52. result = val.match(node_regExp);
  53. magnet = result[1];
  54. name = result[2];
  55. date = result[3];
  56. size = result[4];
  57. site.result.push(new Result(magnet,name,date,size));
  58. })
  59. }
  60. }
  61. },
  62. /* bthaha:{
  63. getUrl:function(code){
  64. var url = "https://bthaha.men/search/";
  65. return url + code;
  66. },
  67. matchResult:function(data){
  68. var i,url,magnet,name,date,size;
  69. var results = new Array();
  70. var links = $(data.responseText).find("a.title");
  71. if(!$.isEmptyObject(links)){
  72. $.each(links,function(key,val){
  73. url = "https://bthaha.men/" + $(val).attr("href");
  74. httpGet(url,function(){
  75.  
  76. })
  77. results.push(new Result(magnet,name,date,size));
  78. })
  79. }
  80. }
  81. },
  82. cltt:{
  83. result:[],
  84. getUrl:function (code){
  85. var url = "https://www.cltt13.xyz/search/";
  86. return url + code + "_ctime_1.html";
  87. },
  88. matchResult:function(data){
  89. var a,b,magnet,name,date,size;
  90. var results = new Array();
  91. var links = $(data.responseText).find('.panel-body');
  92. if(!$.isEmptyObject(links)){
  93. $.each(links,function(key,val){
  94. a = $(val).find('a');
  95. magnet = a.attr('href').match(/\/(\w+).html/)[1];
  96. name = a.text();
  97. b = $(val).find('b');
  98. date = b[0].innerText;
  99. size = b[1].innerText;
  100. site.result.push(new Result(magnet,name,date,size));
  101. })
  102. }
  103. }
  104. } */
  105. }
  106.  
  107. var URL_USER_INFO = "https://webapi.115.com/files/index_info";
  108. var URL_SEARCH = "https://webapi.115.com/files/search?cid=0&limit=50&search_value=";
  109. var URL_VIDEO = "http://115.com/api/video/m3u8/";
  110. var URL_BTSEARCH= "https://btspread.com/search/";
  111. var URL_ADDONETASK = "https://115.com/web/lixian/?ct=lixian&ac=add_task_url";
  112. var URL_ADDMULTITASK = "https://115.com/web/lixian/?ct=lixian&ac=add_task_urls";
  113. var URL_GETTASKLISTS = "https://115.com/web/lixian/?ct=lixian&ac=task_lists";
  114.  
  115. if(urlMatch()){
  116. addMagnetSearch();
  117. }
  118. getCookieState();
  119.  
  120. function getCookieState(){
  121. if(cookie == ""){
  122. msg("脚本中的Cookie为空\n请先在脚本中填写Cookie,否则将无法查询数据!");
  123. }else{
  124. httpGet(URL_USER_INFO,function(xhr){
  125. json = $.parseJSON(xhr.responseText);
  126. if(!json.state){
  127. msg("脚本中的Cookie已过期,请重新填写!");
  128. }else{
  129. if(urlMatch()){
  130. setSingleEle($('div.container'));
  131. }else{
  132. $('a.movie-box').each(function(){
  133. setMultiEles($(this));
  134. })
  135. }
  136. }
  137. })
  138. }
  139. }
  140.  
  141. function urlMatch(){
  142. code = $('div.container').find("span[style='color:#CC0000;']").text();
  143. if(code === ""){
  144. return false;
  145. }else{
  146. return true;
  147. }
  148. }
  149.  
  150. function setMultiEles(node){
  151. var title = node.find('div.photo-info span');
  152. code = title.find('date:first').text();
  153. searchVideo(code,function(pickcode){
  154. setTitleCss(title);
  155. addPlayBtn(pickcode,node.find('div.photo-frame'));
  156. })
  157. }
  158.  
  159. function setSingleEle(node){
  160. searchVideo(code,function(pickcode){
  161. setTitleCss(node.find('h3:first'));
  162. addPlayBtn(pickcode,node.find('div.screencap'));
  163. })
  164. }
  165.  
  166. function searchVideo(fanhao,callback){
  167. httpGet(URL_SEARCH + fanhao,function(xhr){
  168. json = $.parseJSON(xhr.responseText);
  169. if(!$.isEmptyObject(json.data)){
  170. callback(getVideo(json.data));
  171. }else{
  172. if(/\-/.test(fanhao)){
  173. fanhao = fanhao.replace("-","_");
  174. httpGet(URL_SEARCH + fanhao, function(xhr){
  175. json = $.parseJSON(xhr.responseText);
  176. if(!$.isEmptyObject(json.data)){
  177. callback(getVideo(json.data));
  178. }else{
  179. fanhao = fanhao.replace("_","");
  180. httpGet(URL_SEARCH + fanhao, function(xhr){
  181. json = $.parseJSON(xhr.responseText);
  182. if(!$.isEmptyObject(json.data)){
  183. callback(getVideo(json.data));
  184. }
  185. })
  186. }
  187. })
  188. }else{
  189. fanhao = fanhao.replace("_","-");
  190. httpGet(URL_SEARCH + fanhao, function(xhr){
  191. json = $.parseJSON(xhr.responseText);
  192. if(!$.isEmptyObject(json.data)){
  193. callback(getVideo(json.data));
  194. }
  195. })
  196. }
  197. }
  198. })
  199. }
  200.  
  201. function addPlayBtn(pickcode,node){
  202. node.append("<a class='play-box' href='javascript:;'><i class='play-ico'></i></a>");
  203. node.find('a.play-box').on('click',function(){
  204. startPlay(pickcode);
  205. })
  206. }
  207.  
  208. function getVideo(data){
  209. var regExp = /avi|mp4|wmv|mkv/;
  210. for(var i=0;i<data.length;i++){
  211. if(!$.isEmptyObject(data[i].pc)){
  212. var name = data[i].ico;
  213. if(name){
  214. if(name.search(regExp) >= 0){
  215. return data[i].pc;
  216. }
  217. }
  218. }
  219. }
  220. }
  221.  
  222. function startPlay(pickcode){
  223. httpGet(URL_VIDEO + pickcode + ".m3u8",function(xhr){
  224. var arr = xhr.responseText.split("\n");
  225. arr.shift();
  226. arr.pop();
  227. var num,index,max = 0;
  228. for(var i=0;i<=arr.length - 2;i=i+2){
  229. num = Number(arr[i].match(/BANDWIDTH=(\d+)/)[1]);
  230. if(num == 3000000){
  231. index = i;
  232. break;
  233. }
  234. if(num > max){
  235. index = i;
  236. max = num;
  237. }
  238. }
  239. window.location.href = "potplayer://" + arr[index+1];
  240. })
  241. }
  242.  
  243. function setTitleCss(ele){
  244. ele.css("font-weight","bold");
  245. ele.css("color","blue");
  246. }
  247.  
  248. function httpGet(url,load,loadstart){
  249. GM_xmlhttpRequest({
  250. method:"GET",
  251. url:url,
  252. headers:{'Cookie':cookie},
  253. onloadstart: loadstart,
  254. onload:xhr => load(xhr)
  255. })
  256. }
  257.  
  258. function httpPost(url,data,callback){
  259. GM_xmlhttpRequest({
  260. method:"POST",
  261. url:url,
  262. headers:{
  263. 'Content-Type':'application/x-www-form-urlencoded',
  264. 'Cookie':cookie
  265. },
  266. data:data,
  267. onload:xhr => callback(xhr)
  268. })
  269. }
  270.  
  271. function msg(content){
  272. GM_notification(content,"油猴脚本\"115已有影片标记\"");
  273. }
  274.  
  275. function msgBox(type,title,content){
  276. var node,box;
  277. //var heading = `<div class="panel-heading" style='font-size:16px'><b>`+ title +`</b></div>`;
  278. var heading = `<div class="msgbox-title"><span class="msgbox-close" onclick="$('#msgBox').remove()">×</span><b>`+ title +`</b></div>`;
  279. var body = `<div class="msgbox-body">`+ content +`</div>`;
  280. if(type == 0){
  281. box = `<div id="msgBox" class="msg-box msgbox-info"></div>`;
  282. }else{
  283. box = `<div id="msgBox" class="msg-box msgbox-danger"></div>`;
  284. }
  285. $('body').append(box);
  286. $('div.msg-box').append(heading);
  287. $('div.msg-box').append(body);
  288. }
  289.  
  290. function addOffTask(text){
  291. if(confirm("确定添加到115离线吗?")){
  292. if(/\n/.test(text)){
  293. addMultiMagnet(text);
  294. }else{
  295. addOneMagnet(text);
  296. }
  297. $('#layer-bt').remove();
  298. }
  299. }
  300.  
  301. function addOneMagnet(magnetLink){
  302. httpPost(URL_ADDONETASK,"url=" + magnetLink,function(xhr){
  303. json = $.parseJSON(xhr.responseText);
  304. if(json.state){
  305. alert("任务添加成功!\n刷新一下网页,如果标题变蓝,点击封面图即可播放\n如果没有,请30秒后再尝试,还是没有请换个磁链离线");
  306. /* setInterval(function(){
  307. getTaskStatus(magnetLink);
  308. },2000) */
  309. }else{
  310. alert(json.error_msg);
  311. }
  312. })
  313. }
  314.  
  315. function addMultiMagnet(text){
  316. var err_task = new Array();
  317. var links = text.split('\n');
  318. for(var i = 0; i < links.length; i++){
  319. links[i] = "url[" + i + "]=" + links[i];
  320. }
  321. httpPost(URL_ADDMULTITASK,links.join("&"),function(xhr){
  322. json = $.parseJSON(xhr.responseText);
  323. if(json.state){
  324. $.each(json.result,function(key,val){
  325. if(!val.state){
  326. err_task.push(val);
  327. }
  328. })
  329. if(err_task.length){
  330. openErrTaskWindow(err_task);
  331. }else{
  332. alert("所有任务添加成功!");
  333. }
  334. }else{
  335. alert(json.error_msg);
  336. }
  337. })
  338. }
  339.  
  340. function addMagnetSearch(){
  341. var node = (`
  342. <h4>磁力链接——数据来源:<select id='bt-sites' disabled></select></h4>
  343. <div id='data-list' class='panel panel-default'>
  344. <div class="panel-heading">
  345. <div class="panel-title">
  346. <span>搜索结果</span>
  347. </div>
  348. </div>
  349. <div class="panel-body">
  350. </div>
  351. </div>
  352. `);
  353. $('div#movie-share').remove()//删除分享节点
  354. $('div.container .row.movie').after(node);
  355. $('#bt-sites').on('change',function(){
  356. getMagnet(code);
  357. });
  358. loadBTSites();
  359. getMagnet(code);
  360. }
  361.  
  362. function addSearchResult(){
  363. var node = $('div#data-list');
  364. var list =node.find('div.panel-body');
  365. $('select#bt-sites').removeAttr("disabled");
  366. list.find('span').remove();//去除“未找到磁链”字样
  367. if(!$.isEmptyObject(site.result)){
  368. $.each(site.result,function(index,val){
  369. list.append(
  370. "<a class='btn btn-default magnet-link' href='magnet:?xt=urn:btih:"+ val.magnet +"'>"+ (val.name.length>30 ? val.name.substring(0,30) + "..." : val.name) +
  371. " <span class='label label-info'>" + val.size + " / " + val.date + "</span>"+
  372. "</a>"
  373. )
  374. });
  375. list.find('a').on('click',function(){
  376. addOffTask($(this).attr('href'));
  377. event.returnValue=false;
  378. })
  379. }else{
  380. list.append("<span>没有找到相关磁链</span>");
  381. }
  382. }
  383.  
  384. function getMagnet(code){
  385. var node = $('div#data-list div.panel-body');
  386. node.empty();//清空当前搜索结果
  387. site = sites[$('#bt-sites').val()];//设置当前搜索站点
  388. if($.isEmptyObject(site.result)){
  389. httpGet(site.getUrl(code),addMagnetLink,function(){node.append('<span>搜索中...</span>')});
  390. }else{
  391. addSearchResult();
  392. }
  393. }
  394.  
  395. function loadBTSites(){
  396. $.each(sites,function(key,val){
  397. $('#bt-sites').append('<option value="' +key+'">'+key+'</option>')
  398. })
  399. }
  400.  
  401. function addMagnetLink(data){
  402. site.matchResult(data);
  403. addSearchResult();
  404. }
  405.  
  406. function openBTWindow(){
  407. $("body").append(`
  408. <div id="layer-bt" style="z-index: 101; width: 600px; height: 380px;">
  409. <div class="w-layer-title">新建离线任务</div>
  410. <div class="layui-layer-content">
  411. <div id="JS_try_BT2" class="layui-layer-wrap" style="display: block;">
  412. <div class="fct mt15 mb8">
  413. <textarea id="dl-text" rows="9" placeholder="支持HTTP、HTTPS、FTP、磁力链和电驴链接,换行可添加多个" style="width: 550px;"></textarea>
  414. </div>
  415. <p class="fct" style="padding: 20px 0px;">
  416. <button type="button" id='add-bt-btn'>添加</button>
  417. </p>
  418. </div>
  419. </div>
  420. <span class="layui-layer-setwin"><a href="javascript:;" class="layui-layer-close" onclick="$('div#layer-bt').remove()"></a></span>
  421. <span class="layui-layer-resize"></span>
  422. </div>
  423. `);
  424. $('button#add-bt-btn').on('click',function(){addOffTask($('#dl-text').val())});
  425. }
  426.  
  427. function openErrTaskWindow(task){
  428. $("body").append(`
  429. <div id="err-task-window" class='msg-box msgbox-danger'>
  430. <div class='msgbox-title'><span class="msgbox-close" onclick="$('#err-task-window').remove()">×</span><b>以下链接离线失败</b></div>
  431. <div class='msgbox-body'>
  432. <table class='table'>
  433. <thead>
  434. <th>链接</th>
  435. <th>原因</th>
  436. </thead>
  437. <tbody></tbody>
  438. </table>
  439. </div>
  440. </div>
  441. `)
  442. var node = $('#err-task-window').find('tbody');
  443. $.each(task,function(key,val){
  444. node.append(`
  445. <tr>
  446. <td><a href='`+ val.url +`'>`+ val.url.substring(0,30) +`...</a></td>
  447. <td>`+ val.error_msg +`</td>
  448. </tr>
  449. `)
  450. })
  451. }
  452.  
  453. function getTaskStatus(link){
  454. httpPost(URL_GETTASKLISTS,"page=2",function(xhr){
  455. json = $.parseJSON(xhr.responseText);
  456. if(json.state){
  457. $.each(json.tasks,function(key,val){
  458. if(val.url === link){
  459. console.log(val.percentDone)
  460. if(val.status === 2){
  461. location.reload();
  462. }
  463. }
  464. })
  465. }
  466. })
  467. }
  468.  
  469. document.addEventListener("keydown", function(e) {
  470. if(e.keyCode == 120) {
  471. if($('div#layer-bt').length){
  472. $('div#layer-bt').remove();
  473. }else{
  474. openBTWindow();
  475. }
  476. }
  477. });
  478.  
  479. function Result(magnet,name,size,date){
  480. this.magnet = magnet;
  481. this.name = name;
  482. this.size = size;
  483. this.date = date;
  484. }
  485.  
  486. GM_addStyle(`
  487. div.photo-frame{
  488. position:relative;
  489. }
  490.  
  491. a.play-box{
  492. display:none;
  493. width:100%;
  494. height:100%;
  495. position:absolute;
  496. top:0;
  497. background:rgba(207,207,207,0.5);
  498. }
  499.  
  500. i.play-ico{
  501. width:50px;
  502. height:50px;
  503. background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAACC0lEQVRoQ+2a0W2DMBCGfc956QgMkB3abtJuABMUJijZINkg3SDZIJVMkke6QSLhPMVc5QgiKwoRYIyPCL9j3cfd7/s5DOxJFjwJBxtBqGWyMiOe571MJpNvAPAYY6ssy2Zpmh6oAZTxVIJMp9OQMfalBa4gQs75jCLMI5AVY+z1NmhETPM8D3a73ZISUGMQLfgVIgZJkmwoAJmAXOJHxLkQInCtH2OQIhtKP7HLA6ErkDI7qToQkiRZ9F1unYLo+mGMRZxzdWD0smyBXPUjpYz2+73KlNVlFUSLPLStn75AFNMBEX1b+ukTpCy3DQAEXeundxCt3Jbn8znoSj8uQcoMxUKIyLShOgfRGqqRIaUCcm2oAPDZRj+kQEwMKVWQxoaUNIhuSDnn0SNrMASQa/8RQrxXnW6DAVE0eZ7Pttutfy8zI4hVK3tnc0T8FUK8Dbm0jurrk3OupjqVi3RpIeJCCOHXsS9UQdaF5a89oSEFgoh/APAxZItyREQ1tIjbHiLOM6J6w+l0CuvogKTYEfFHSukP9sNK9QMA8NvogEpGlA7U8GHeVgeuQS4NLcuy2FQHzkBUQ5NShl3pwAXIuvgpNMyRqWpoxRDbig76yEgtY2dD5OWexg2xibGjCtLY2JECMTF2rkBuf08bGzsnIMWFgVi7MGC1oZlCjndRTN9g18+PGen6jZru9w9A+YlCWMD4+gAAAABJRU5ErkJggg==);
  504. position:absolute;
  505. top:50%;
  506. left:50%;
  507. transform: translate(-50%, -50%);
  508. }
  509.  
  510. div.photo-frame:hover a.play-box{
  511. display:block;
  512. }
  513.  
  514. div.screencap:hover a.play-box{
  515. display:block;
  516. }
  517.  
  518. #layer-bt,.msg-box{
  519. position: fixed;
  520. background: #fff;
  521. border-radius: 5px!important;
  522. left: 50%;
  523. top: 50%;
  524. transform: translate(-50%, -50%);
  525. box-shadow: 1px 1px 50px rgba(0,0,0,.3);
  526. }
  527.  
  528. .w-layer-title {
  529. height: 48px;
  530. line-height: 48px;
  531. border-radius: 5px 5px 0 0!important;
  532. border-bottom: 1px solid #eee;
  533. font-size: 16px;
  534. color: #333;
  535. overflow: hidden;
  536. background-color: #f8f8f8;
  537. padding: 0 80px 0 20px;
  538. }
  539.  
  540. .layui-layer-content {
  541. position: relative;
  542. }
  543.  
  544. .mb8 {
  545. margin-bottom: 8px;
  546. }
  547.  
  548. .mt15 {
  549. margin-top: 15px;
  550. }
  551.  
  552. .fct {
  553. text-align: center;
  554. }
  555.  
  556. .layui-layer-setwin {
  557. position: absolute;
  558. right: 15px;
  559. top: 15px;
  560. font-size: 0;
  561. line-height: normal;
  562. }
  563.  
  564. .layui-layer-close {
  565. display: inline-block;
  566. cursor: pointer;
  567. background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAwklEQVQ4T6WT0Q3CMAxEXzeADdiAsgGjwAYwCWxQRmEDYBIYAV1VSya100jkL4nu6XyXdPy5OmADPIAzcGvkHYALsBNA6wlsgWMDROIBeAG9AVbAvQHixXvgYwC5WILMxBJ5QA0SiiNABNGZzTza9kGXDuzOj6MzBTYTZw4Mcpqq0l4VX6OKMwd+ZunSiiNAGZgAacUlIEs7rdgD0qqm2UOIAZbEUTvjsxdA5HetqiJ972RtDtSxPtTPI6n8TEF6hfsFORY8Qcjn1/kAAAAASUVORK5CYII=);
  568. width: 16px;
  569. height: 16px;
  570. }
  571.  
  572. #add-bt-btn {
  573. line-height: 1;
  574. border: 1px solid #dcdfe6;
  575. padding: 12px 30px;
  576. border-radius: 4px;
  577. color: #fff;
  578. background-color: #409eff;
  579. border-color: #409eff;
  580. font-size: 16px;
  581. }
  582.  
  583. #dl-text {
  584. padding: 9px 11px;
  585. line-height: 1.6;
  586. border: 1px solid #e6e6e6;
  587. border-radius: 3px;
  588. background: #fff;
  589. color: #333;
  590. font-size: 14px;
  591. transition: border-color .15s;
  592. outline: 0;
  593. resize: none;
  594. }
  595.  
  596. a.magnet-link{
  597. margin: 0px 10px 10px 0px;
  598. }
  599.  
  600. .msg-box{
  601. min-width:500px;
  602. border:1px solid transparent;
  603. border-radius:4px;
  604. }
  605.  
  606. .msgbox-close{
  607. float:right;
  608. cursor: pointer;
  609. font-size:21px;
  610. font-weight:700;
  611. line-height:1;
  612. }
  613.  
  614. .msgbox-title{
  615. padding:10px 15px;
  616. border-bottom:1px solid transparent
  617. }
  618.  
  619. .msgbox-body{
  620. padding:15px;
  621. }
  622.  
  623. .msgbox-info{
  624. border-color:#337ab7;
  625. }
  626.  
  627. .msgbox-info .msgbox-close{
  628. color:#fff;
  629. }
  630.  
  631. .msgbox-info .msgbox-title{
  632. color:#fff;
  633. background-color:#337ab7;
  634. border-color:#337ab7;
  635. }
  636.  
  637. .msgbox-danger{
  638. border-color:#ebccd1;
  639. }
  640.  
  641. .msgbox-danger .msgbox-close{
  642. color:#a94442;
  643. }
  644.  
  645. .msgbox-danger .msgbox-title{
  646. color:#a94442;
  647. background-color:#f2dede;
  648. border-color:#ebccd1;
  649. }
  650. `);
  651. })();