- 安裝 node.js
- 會使用指令介面 (cmd,bash,...)
- 把這個 gist 下載成一個 zip 檔後解壓縮
- 在裡面執行
npm i - 把目標 apk 放到同個資料夾
| const m=` | |
| // @name 動畫瘋工具箱 | |
| // @namespace https://blog.maple3142.net/ | |
| // @version 0.4 | |
| // @description 取得動畫的 m3u8 網址,下載彈幕為 json,去除擋廣告的警告訊息 | |
| // @author maple3142 | |
| // @match https://ani.gamer.com.tw/animeVideo.php?sn=* | |
| // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/m3u8-parser.min.js | |
| // @grant none | |
| ` |
| const n=3 | |
| function c2da(n,m){ | |
| const ar=[] | |
| for(let i=0;i<n;i++)ar[i]=[] | |
| return ar | |
| } | |
| const ar=c2da(n+1,n+1) | |
| const vis=c2da(n+1,n+1) | |
| const X=[1,0,-1,0] | |
| const Y=[0,-1,0,1] |
| (await Promise.all($('a').toArray().filter(x=>/^http.*\d{10}$/.test(x.textContent)).slice(1).map(r=>r.textContent.trim().replace('http:','https:')).map(x=>{ | |
| return Promise.all([fetch(x).then(x=>x.text()),fetch(x+'?pn=2').then(x=>x.text())]) | |
| }))).map(x=>{ | |
| if($(x[0]).find('.l_pager').text())return x.join('') | |
| else return x[0] | |
| }).map(x=>$(x).find('.d_post_content').toArray().reduce((d,x)=>{ | |
| const div=document.createElement('div') | |
| div.innerHTML=x.innerHTML.replace(/<br>/g,'\n').replace(/</g,'<').replace(/>/g,'>') | |
| if(div.textContent.replace(/(\n| )/g,'').length>=50&&!div.textContent.includes('广告')&&!div.textContent.includes('免费'))return d+'\n'+div.textContent |
| // 'beforescriptexecute' event [es5] | |
| // original version: https://gist.github.com/jspenguin2017/cd568a50128c71e515738413cd09a890 | |
| ;(function() { | |
| ;('use strict') | |
| function Event(script, target) { | |
| this.script = script | |
| this.target = target | |
| this._cancel = false |
| function show_git_branch() | |
| for line in io.popen("git branch 2>nul"):lines() do | |
| local m = line:match("%* (.+)$") | |
| local b = "\x1b[32;22;49m".."("..m..")".."\x1b[39;22;49m" | |
| if m then | |
| clink.prompt.value = clink.prompt.value:gsub(">"," "..b.." >") | |
| break | |
| end | |
| end | |
| return false |
| (await Promise.all([1,2,3].map(x=>fetch(`https://tieba.baidu.com/p/5626879744?pn=${x}`).then(r=>r.text())))).filter((x,i)=>parseInt($(x).find('.tP')[0].textContent)===i+1).map(x=>$(x).find('.d_post_content').toArray().reduce((d,x)=>{ | |
| const div=document.createElement('div') | |
| div.innerHTML=x.innerHTML.replace(/<br>/g,'\n').replace(/</g,'<').replace(/>/g,'>') | |
| if(div.textContent.replace(/(\n| )/g,'').length>=50&&!div.textContent.includes('广告')&&!div.textContent.includes('免费'))return d+'\n'+div.textContent | |
| else return d | |
| },'').trim()).join('\n\n') |
| (function(global) { | |
| 'use strict' | |
| const pjax={} | |
| pjax._get=url=>{ | |
| return new Promise((res,rej)=>{ | |
| const xhr=new XMLHttpRequest() | |
| xhr.open('GET', url) | |
| xhr.onload=()=>res([xhr.responseText,xhr]) | |
| xhr.onerror=rej | |
| xhr.send() |
| // outdated | |
| // please heads for https://github.com/maple3142/ytdl | |
| const axios = require('axios') | |
| const parseQuery = s => { | |
| const o = s | |
| .split('&') | |
| .map(x => x.split('=')) | |
| .reduce((p, c) => { |