diff --git a/.electron-builder.config.js b/.electron-builder.config.js index eec94ccf..903aaed5 100644 --- a/.electron-builder.config.js +++ b/.electron-builder.config.js @@ -42,7 +42,9 @@ module.exports = async function () { }, // Specify linux target just for disabling snap compilation linux: { - target: 'deb' + target: 'deb', + maintainer: 'radishes@gitub.com', + vendor: 'radishes@gitub.com' } } } diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 016f0ae3..8135b509 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,10 +8,12 @@ on: jobs: install: - name: Install dependencies and cache modeles + name: Cache node_modules runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: recursive - name: Cache node modules id: cache-node-modules @@ -38,7 +40,7 @@ jobs: steps.cache-cypress-binary.outputs.cache-hit != 'true' run: | corepack enable - yarn + yarn workspaces foreach install # cypress-run: # name: Cypress run @@ -95,11 +97,13 @@ jobs: # ./script/deploy.sh $ACCESS_TOKEN github.com/hq001/test_video.git tests/e2e lint: - name: Yarn build + name: Lint code runs-on: ubuntu-latest needs: install steps: - uses: actions/checkout@v2 + with: + submodules: recursive - uses: actions/setup-node@v1 with: @@ -118,7 +122,7 @@ jobs: if: steps.cache-node-modules.outputs.cache-hit != 'true' run: | corepack enable - yarn install --frozen-lockfile + yarn workspaces foreach install - name: Lint run: | @@ -126,35 +130,57 @@ jobs: yarn lint build-electron: - name: Automatically release electron version - runs-on: macos-latest + name: Deploy Radishes + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} needs: install steps: - uses: actions/checkout@v2 + with: + submodules: recursive - uses: actions/setup-node@v1 with: node-version: 16 - - name: Load node_modules - id: cache-node-modules - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + # - name: Load node_modules + # id: cache-node-modules + # uses: actions/cache@v2 + # with: + # path: | + # node_modules + # */*/node_modules + # key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - name: Install - if: steps.cache-node-modules.outputs.cache-hit != 'true' + # if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: | + corepack enable + yarn workspaces foreach install + + - name: Build electron win + if: matrix.os == 'windows-latest' run: | corepack enable - yarn install --frozen-lockfile + yarn pkg:win + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build electron linux + if: matrix.os == 'ubuntu-latest' + run: | + corepack enable + yarn pkg:linux + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build electron + - name: Build electron macos + if: matrix.os == 'macos-latest' run: | corepack enable - yarn pkg + yarn pkg:macos env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f8e314fd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "radishes-v2"] + path = packages/api + url = git@github.com:radishes-music/NeteaseCloudMusicApi.git + branch = radishes diff --git a/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs b/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs new file mode 100644 index 00000000..4e89c7c3 --- /dev/null +++ b/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs @@ -0,0 +1,28 @@ +/* eslint-disable */ +//prettier-ignore +module.exports = { +name: "@yarnpkg/plugin-workspace-tools", +factory: function (require) { +var plugin=(()=>{var yr=Object.create;var we=Object.defineProperty;var _r=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var br=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty;var W=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var q=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Cr=(e,r)=>{for(var t in r)we(e,t,{get:r[t],enumerable:!0})},Je=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Er(r))!xr.call(e,s)&&s!==t&&we(e,s,{get:()=>r[s],enumerable:!(n=_r(r,s))||n.enumerable});return e};var Be=(e,r,t)=>(t=e!=null?yr(br(e)):{},Je(r||!e||!e.__esModule?we(t,"default",{value:e,enumerable:!0}):t,e)),wr=e=>Je(we({},"__esModule",{value:!0}),e);var ve=q(ee=>{"use strict";ee.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;ee.find=(e,r)=>e.nodes.find(t=>t.type===r);ee.exceedsLimit=(e,r,t=1,n)=>n===!1||!ee.isInteger(e)||!ee.isInteger(r)?!1:(Number(r)-Number(e))/Number(t)>=n;ee.escapeNode=(e,r=0,t)=>{let n=e.nodes[r];!n||(t&&n.type===t||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ee.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;ee.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;ee.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;ee.reduce=e=>e.reduce((r,t)=>(t.type==="text"&&r.push(t.value),t.type==="range"&&(t.type="text"),r),[]);ee.flatten=(...e)=>{let r=[],t=n=>{for(let s=0;s{"use strict";var tt=ve();rt.exports=(e,r={})=>{let t=(n,s={})=>{let i=r.escapeInvalid&&tt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c="";if(n.value)return(i||a)&&tt.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let p of n.nodes)c+=t(p);return c};return t(e)}});var st=q((Vn,nt)=>{"use strict";nt.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var ht=q((Jn,pt)=>{"use strict";var at=st(),le=(e,r,t)=>{if(at(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(r===void 0||e===r)return String(e);if(at(r)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...t};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),c=String(n.wrap),p=e+":"+r+"="+s+i+a+c;if(le.cache.hasOwnProperty(p))return le.cache[p].result;let m=Math.min(e,r),h=Math.max(e,r);if(Math.abs(m-h)===1){let y=e+"|"+r;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let R=ft(e)||ft(r),f={min:e,max:r,a:m,b:h},$=[],_=[];if(R&&(f.isPadded=R,f.maxLen=String(f.max).length),m<0){let y=h<0?Math.abs(h):1;_=it(y,Math.abs(m),f,n),m=f.a=0}return h>=0&&($=it(m,h,f,n)),f.negatives=_,f.positives=$,f.result=Sr(_,$,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&$.length+_.length>1&&(f.result=`(?:${f.result})`),le.cache[p]=f,f.result};function Sr(e,r,t){let n=Pe(e,r,"-",!1,t)||[],s=Pe(r,e,"",!1,t)||[],i=Pe(e,r,"-?",!0,t)||[];return n.concat(i).concat(s).join("|")}function vr(e,r){let t=1,n=1,s=ut(e,t),i=new Set([r]);for(;e<=s&&s<=r;)i.add(s),t+=1,s=ut(e,t);for(s=ct(r+1,n)-1;e1&&c.count.pop(),c.count.push(h.count[0]),c.string=c.pattern+lt(c.count),a=m+1;continue}t.isPadded&&(R=Lr(m,t,n)),h.string=R+h.pattern+lt(h.count),i.push(h),a=m+1,c=h}return i}function Pe(e,r,t,n,s){let i=[];for(let a of e){let{string:c}=a;!n&&!ot(r,"string",c)&&i.push(t+c),n&&ot(r,"string",c)&&i.push(t+c)}return i}function $r(e,r){let t=[];for(let n=0;nr?1:r>e?-1:0}function ot(e,r,t){return e.some(n=>n[r]===t)}function ut(e,r){return Number(String(e).slice(0,-r)+"9".repeat(r))}function ct(e,r){return e-e%Math.pow(10,r)}function lt(e){let[r=0,t=""]=e;return t||r>1?`{${r+(t?","+t:"")}}`:""}function kr(e,r,t){return`[${e}${r-e===1?"":"-"}${r}]`}function ft(e){return/^-?(0+)\d/.test(e)}function Lr(e,r,t){if(!r.isPadded)return e;let n=Math.abs(r.maxLen-String(e).length),s=t.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}le.cache={};le.clearCache=()=>le.cache={};pt.exports=le});var Ue=q((es,Et)=>{"use strict";var Or=W("util"),At=ht(),dt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Nr=e=>r=>e===!0?Number(r):String(r),Me=e=>typeof e=="number"||typeof e=="string"&&e!=="",Ae=e=>Number.isInteger(+e),De=e=>{let r=`${e}`,t=-1;if(r[0]==="-"&&(r=r.slice(1)),r==="0")return!1;for(;r[++t]==="0";);return t>0},Ir=(e,r,t)=>typeof e=="string"||typeof r=="string"?!0:t.stringify===!0,Br=(e,r,t)=>{if(r>0){let n=e[0]==="-"?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?r-1:r,"0")}return t===!1?String(e):e},gt=(e,r)=>{let t=e[0]==="-"?"-":"";for(t&&(e=e.slice(1),r--);e.length{e.negatives.sort((a,c)=>ac?1:0),e.positives.sort((a,c)=>ac?1:0);let t=r.capture?"":"?:",n="",s="",i;return e.positives.length&&(n=e.positives.join("|")),e.negatives.length&&(s=`-(${t}${e.negatives.join("|")})`),n&&s?i=`${n}|${s}`:i=n||s,r.wrap?`(${t}${i})`:i},mt=(e,r,t,n)=>{if(t)return At(e,r,{wrap:!1,...n});let s=String.fromCharCode(e);if(e===r)return s;let i=String.fromCharCode(r);return`[${s}-${i}]`},Rt=(e,r,t)=>{if(Array.isArray(e)){let n=t.wrap===!0,s=t.capture?"":"?:";return n?`(${s}${e.join("|")})`:e.join("|")}return At(e,r,t)},yt=(...e)=>new RangeError("Invalid range arguments: "+Or.inspect(...e)),_t=(e,r,t)=>{if(t.strictRanges===!0)throw yt([e,r]);return[]},Mr=(e,r)=>{if(r.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},Dr=(e,r,t=1,n={})=>{let s=Number(e),i=Number(r);if(!Number.isInteger(s)||!Number.isInteger(i)){if(n.strictRanges===!0)throw yt([e,r]);return[]}s===0&&(s=0),i===0&&(i=0);let a=s>i,c=String(e),p=String(r),m=String(t);t=Math.max(Math.abs(t),1);let h=De(c)||De(p)||De(m),R=h?Math.max(c.length,p.length,m.length):0,f=h===!1&&Ir(e,r,n)===!1,$=n.transform||Nr(f);if(n.toRegex&&t===1)return mt(gt(e,R),gt(r,R),!0,n);let _={negatives:[],positives:[]},y=T=>_[T<0?"negatives":"positives"].push(Math.abs(T)),E=[],S=0;for(;a?s>=i:s<=i;)n.toRegex===!0&&t>1?y(s):E.push(Br($(s,S),R,f)),s=a?s-t:s+t,S++;return n.toRegex===!0?t>1?Pr(_,n):Rt(E,null,{wrap:!1,...n}):E},Ur=(e,r,t=1,n={})=>{if(!Ae(e)&&e.length>1||!Ae(r)&&r.length>1)return _t(e,r,n);let s=n.transform||(f=>String.fromCharCode(f)),i=`${e}`.charCodeAt(0),a=`${r}`.charCodeAt(0),c=i>a,p=Math.min(i,a),m=Math.max(i,a);if(n.toRegex&&t===1)return mt(p,m,!1,n);let h=[],R=0;for(;c?i>=a:i<=a;)h.push(s(i,R)),i=c?i-t:i+t,R++;return n.toRegex===!0?Rt(h,null,{wrap:!1,options:n}):h},$e=(e,r,t,n={})=>{if(r==null&&Me(e))return[e];if(!Me(e)||!Me(r))return _t(e,r,n);if(typeof t=="function")return $e(e,r,1,{transform:t});if(dt(t))return $e(e,r,0,t);let s={...n};return s.capture===!0&&(s.wrap=!0),t=t||s.step||1,Ae(t)?Ae(e)&&Ae(r)?Dr(e,r,t,s):Ur(e,r,Math.max(Math.abs(t),1),s):t!=null&&!dt(t)?Mr(t,s):$e(e,r,1,t)};Et.exports=$e});var Ct=q((ts,xt)=>{"use strict";var Gr=Ue(),bt=ve(),qr=(e,r={})=>{let t=(n,s={})=>{let i=bt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c=i===!0||a===!0,p=r.escapeInvalid===!0?"\\":"",m="";if(n.isOpen===!0||n.isClose===!0)return p+n.value;if(n.type==="open")return c?p+n.value:"(";if(n.type==="close")return c?p+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":c?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let h=bt.reduce(n.nodes),R=Gr(...h,{...r,wrap:!1,toRegex:!0});if(R.length!==0)return h.length>1&&R.length>1?`(${R})`:R}if(n.nodes)for(let h of n.nodes)m+=t(h,n);return m};return t(e)};xt.exports=qr});var vt=q((rs,St)=>{"use strict";var Kr=Ue(),wt=He(),he=ve(),fe=(e="",r="",t=!1)=>{let n=[];if(e=[].concat(e),r=[].concat(r),!r.length)return e;if(!e.length)return t?he.flatten(r).map(s=>`{${s}}`):r;for(let s of e)if(Array.isArray(s))for(let i of s)n.push(fe(i,r,t));else for(let i of r)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?fe(s,i,t):s+i);return he.flatten(n)},Wr=(e,r={})=>{let t=r.rangeLimit===void 0?1e3:r.rangeLimit,n=(s,i={})=>{s.queue=[];let a=i,c=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,c=a.queue;if(s.invalid||s.dollar){c.push(fe(c.pop(),wt(s,r)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){c.push(fe(c.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let R=he.reduce(s.nodes);if(he.exceedsLimit(...R,r.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Kr(...R,r);f.length===0&&(f=wt(s,r)),c.push(fe(c.pop(),f)),s.nodes=[];return}let p=he.encloseBrace(s),m=s.queue,h=s;for(;h.type!=="brace"&&h.type!=="root"&&h.parent;)h=h.parent,m=h.queue;for(let R=0;R{"use strict";Ht.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` +`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Nt=q((ss,Ot)=>{"use strict";var jr=He(),{MAX_LENGTH:Tt,CHAR_BACKSLASH:Ge,CHAR_BACKTICK:Fr,CHAR_COMMA:Qr,CHAR_DOT:Xr,CHAR_LEFT_PARENTHESES:Zr,CHAR_RIGHT_PARENTHESES:Yr,CHAR_LEFT_CURLY_BRACE:zr,CHAR_RIGHT_CURLY_BRACE:Vr,CHAR_LEFT_SQUARE_BRACKET:kt,CHAR_RIGHT_SQUARE_BRACKET:Lt,CHAR_DOUBLE_QUOTE:Jr,CHAR_SINGLE_QUOTE:en,CHAR_NO_BREAK_SPACE:tn,CHAR_ZERO_WIDTH_NOBREAK_SPACE:rn}=$t(),nn=(e,r={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let t=r||{},n=typeof t.maxLength=="number"?Math.min(Tt,t.maxLength):Tt;if(e.length>n)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${n})`);let s={type:"root",input:e,nodes:[]},i=[s],a=s,c=s,p=0,m=e.length,h=0,R=0,f,$={},_=()=>e[h++],y=E=>{if(E.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&E.type==="text"){c.value+=E.value;return}return a.nodes.push(E),E.parent=a,E.prev=c,c=E,E};for(y({type:"bos"});h0){if(a.ranges>0){a.ranges=0;let E=a.nodes.shift();a.nodes=[E,{type:"text",value:jr(a)}]}y({type:"comma",value:f}),a.commas++;continue}if(f===Xr&&R>0&&a.commas===0){let E=a.nodes;if(R===0||E.length===0){y({type:"text",value:f});continue}if(c.type==="dot"){if(a.range=[],c.value+=f,c.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,c.type="text";continue}a.ranges++,a.args=[];continue}if(c.type==="range"){E.pop();let S=E[E.length-1];S.value+=c.value+f,c=S,a.ranges--;continue}y({type:"dot",value:f});continue}y({type:"text",value:f})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(T=>{T.nodes||(T.type==="open"&&(T.isOpen=!0),T.type==="close"&&(T.isClose=!0),T.nodes||(T.type="text"),T.invalid=!0)});let E=i[i.length-1],S=E.nodes.indexOf(a);E.nodes.splice(S,1,...a.nodes)}while(i.length>0);return y({type:"eos"}),s};Ot.exports=nn});var Pt=q((as,Bt)=>{"use strict";var It=He(),sn=Ct(),an=vt(),on=Nt(),Z=(e,r={})=>{let t=[];if(Array.isArray(e))for(let n of e){let s=Z.create(n,r);Array.isArray(s)?t.push(...s):t.push(s)}else t=[].concat(Z.create(e,r));return r&&r.expand===!0&&r.nodupes===!0&&(t=[...new Set(t)]),t};Z.parse=(e,r={})=>on(e,r);Z.stringify=(e,r={})=>It(typeof e=="string"?Z.parse(e,r):e,r);Z.compile=(e,r={})=>(typeof e=="string"&&(e=Z.parse(e,r)),sn(e,r));Z.expand=(e,r={})=>{typeof e=="string"&&(e=Z.parse(e,r));let t=an(e,r);return r.noempty===!0&&(t=t.filter(Boolean)),r.nodupes===!0&&(t=[...new Set(t)]),t};Z.create=(e,r={})=>e===""||e.length<3?[e]:r.expand!==!0?Z.compile(e,r):Z.expand(e,r);Bt.exports=Z});var me=q((is,qt)=>{"use strict";var un=W("path"),se="\\\\/",Mt=`[^${se}]`,ie="\\.",cn="\\+",ln="\\?",Te="\\/",fn="(?=.)",Dt="[^/]",qe=`(?:${Te}|$)`,Ut=`(?:^|${Te})`,Ke=`${ie}{1,2}${qe}`,pn=`(?!${ie})`,hn=`(?!${Ut}${Ke})`,dn=`(?!${ie}{0,1}${qe})`,gn=`(?!${Ke})`,An=`[^.${Te}]`,mn=`${Dt}*?`,Gt={DOT_LITERAL:ie,PLUS_LITERAL:cn,QMARK_LITERAL:ln,SLASH_LITERAL:Te,ONE_CHAR:fn,QMARK:Dt,END_ANCHOR:qe,DOTS_SLASH:Ke,NO_DOT:pn,NO_DOTS:hn,NO_DOT_SLASH:dn,NO_DOTS_SLASH:gn,QMARK_NO_DOT:An,STAR:mn,START_ANCHOR:Ut},Rn={...Gt,SLASH_LITERAL:`[${se}]`,QMARK:Mt,STAR:`${Mt}*?`,DOTS_SLASH:`${ie}{1,2}(?:[${se}]|$)`,NO_DOT:`(?!${ie})`,NO_DOTS:`(?!(?:^|[${se}])${ie}{1,2}(?:[${se}]|$))`,NO_DOT_SLASH:`(?!${ie}{0,1}(?:[${se}]|$))`,NO_DOTS_SLASH:`(?!${ie}{1,2}(?:[${se}]|$))`,QMARK_NO_DOT:`[^.${se}]`,START_ANCHOR:`(?:^|[${se}])`,END_ANCHOR:`(?:[${se}]|$)`},yn={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};qt.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:yn,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:un.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?Rn:Gt}}});var Re=q(Q=>{"use strict";var _n=W("path"),En=process.platform==="win32",{REGEX_BACKSLASH:bn,REGEX_REMOVE_BACKSLASH:xn,REGEX_SPECIAL_CHARS:Cn,REGEX_SPECIAL_CHARS_GLOBAL:wn}=me();Q.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);Q.hasRegexChars=e=>Cn.test(e);Q.isRegexChar=e=>e.length===1&&Q.hasRegexChars(e);Q.escapeRegex=e=>e.replace(wn,"\\$1");Q.toPosixSlashes=e=>e.replace(bn,"/");Q.removeBackslashes=e=>e.replace(xn,r=>r==="\\"?"":r);Q.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};Q.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:En===!0||_n.sep==="\\";Q.escapeLast=(e,r,t)=>{let n=e.lastIndexOf(r,t);return n===-1?e:e[n-1]==="\\"?Q.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};Q.removePrefix=(e,r={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),r.prefix="./"),t};Q.wrapOutput=(e,r={},t={})=>{let n=t.contains?"":"^",s=t.contains?"":"$",i=`${n}(?:${e})${s}`;return r.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Yt=q((us,Zt)=>{"use strict";var Kt=Re(),{CHAR_ASTERISK:We,CHAR_AT:Sn,CHAR_BACKWARD_SLASH:ye,CHAR_COMMA:vn,CHAR_DOT:je,CHAR_EXCLAMATION_MARK:Fe,CHAR_FORWARD_SLASH:Xt,CHAR_LEFT_CURLY_BRACE:Qe,CHAR_LEFT_PARENTHESES:Xe,CHAR_LEFT_SQUARE_BRACKET:Hn,CHAR_PLUS:$n,CHAR_QUESTION_MARK:Wt,CHAR_RIGHT_CURLY_BRACE:Tn,CHAR_RIGHT_PARENTHESES:jt,CHAR_RIGHT_SQUARE_BRACKET:kn}=me(),Ft=e=>e===Xt||e===ye,Qt=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Ln=(e,r)=>{let t=r||{},n=e.length-1,s=t.parts===!0||t.scanToEnd===!0,i=[],a=[],c=[],p=e,m=-1,h=0,R=0,f=!1,$=!1,_=!1,y=!1,E=!1,S=!1,T=!1,L=!1,z=!1,I=!1,re=0,K,g,v={value:"",depth:0,isGlob:!1},k=()=>m>=n,l=()=>p.charCodeAt(m+1),H=()=>(K=g,p.charCodeAt(++m));for(;m0&&(B=p.slice(0,h),p=p.slice(h),R-=h),w&&_===!0&&R>0?(w=p.slice(0,R),o=p.slice(R)):_===!0?(w="",o=p):w=p,w&&w!==""&&w!=="/"&&w!==p&&Ft(w.charCodeAt(w.length-1))&&(w=w.slice(0,-1)),t.unescape===!0&&(o&&(o=Kt.removeBackslashes(o)),w&&T===!0&&(w=Kt.removeBackslashes(w)));let u={prefix:B,input:e,start:h,base:w,glob:o,isBrace:f,isBracket:$,isGlob:_,isExtglob:y,isGlobstar:E,negated:L,negatedExtglob:z};if(t.tokens===!0&&(u.maxDepth=0,Ft(g)||a.push(v),u.tokens=a),t.parts===!0||t.tokens===!0){let P;for(let b=0;b{"use strict";var ke=me(),Y=Re(),{MAX_LENGTH:Le,POSIX_REGEX_SOURCE:On,REGEX_NON_SPECIAL_CHARS:Nn,REGEX_SPECIAL_CHARS_BACKREF:In,REPLACEMENTS:zt}=ke,Bn=(e,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t)}catch{return e.map(s=>Y.escapeRegex(s)).join("..")}return t},de=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Vt=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=zt[e]||e;let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:t.prepend||""},a=[i],c=t.capture?"":"?:",p=Y.isWindows(r),m=ke.globChars(p),h=ke.extglobChars(m),{DOT_LITERAL:R,PLUS_LITERAL:f,SLASH_LITERAL:$,ONE_CHAR:_,DOTS_SLASH:y,NO_DOT:E,NO_DOT_SLASH:S,NO_DOTS_SLASH:T,QMARK:L,QMARK_NO_DOT:z,STAR:I,START_ANCHOR:re}=m,K=A=>`(${c}(?:(?!${re}${A.dot?y:R}).)*?)`,g=t.dot?"":E,v=t.dot?L:z,k=t.bash===!0?K(t):I;t.capture&&(k=`(${k})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let l={input:e,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};e=Y.removePrefix(e,l),s=e.length;let H=[],w=[],B=[],o=i,u,P=()=>l.index===s-1,b=l.peek=(A=1)=>e[l.index+A],V=l.advance=()=>e[++l.index]||"",J=()=>e.slice(l.index+1),X=(A="",O=0)=>{l.consumed+=A,l.index+=O},Ee=A=>{l.output+=A.output!=null?A.output:A.value,X(A.value)},mr=()=>{let A=1;for(;b()==="!"&&(b(2)!=="("||b(3)==="?");)V(),l.start++,A++;return A%2===0?!1:(l.negated=!0,l.start++,!0)},be=A=>{l[A]++,B.push(A)},oe=A=>{l[A]--,B.pop()},C=A=>{if(o.type==="globstar"){let O=l.braces>0&&(A.type==="comma"||A.type==="brace"),d=A.extglob===!0||H.length&&(A.type==="pipe"||A.type==="paren");A.type!=="slash"&&A.type!=="paren"&&!O&&!d&&(l.output=l.output.slice(0,-o.output.length),o.type="star",o.value="*",o.output=k,l.output+=o.output)}if(H.length&&A.type!=="paren"&&(H[H.length-1].inner+=A.value),(A.value||A.output)&&Ee(A),o&&o.type==="text"&&A.type==="text"){o.value+=A.value,o.output=(o.output||"")+A.value;return}A.prev=o,a.push(A),o=A},xe=(A,O)=>{let d={...h[O],conditions:1,inner:""};d.prev=o,d.parens=l.parens,d.output=l.output;let x=(t.capture?"(":"")+d.open;be("parens"),C({type:A,value:O,output:l.output?"":_}),C({type:"paren",extglob:!0,value:V(),output:x}),H.push(d)},Rr=A=>{let O=A.close+(t.capture?")":""),d;if(A.type==="negate"){let x=k;A.inner&&A.inner.length>1&&A.inner.includes("/")&&(x=K(t)),(x!==k||P()||/^\)+$/.test(J()))&&(O=A.close=`)$))${x}`),A.inner.includes("*")&&(d=J())&&/^\.[^\\/.]+$/.test(d)&&(O=A.close=`)${d})${x})`),A.prev.type==="bos"&&(l.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:u,output:O}),oe("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let A=!1,O=e.replace(In,(d,x,M,j,G,Ie)=>j==="\\"?(A=!0,d):j==="?"?x?x+j+(G?L.repeat(G.length):""):Ie===0?v+(G?L.repeat(G.length):""):L.repeat(M.length):j==="."?R.repeat(M.length):j==="*"?x?x+j+(G?k:""):k:x?d:`\\${d}`);return A===!0&&(t.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,d=>d.length%2===0?"\\\\":d?"\\":"")),O===e&&t.contains===!0?(l.output=e,l):(l.output=Y.wrapOutput(O,l,r),l)}for(;!P();){if(u=V(),u==="\0")continue;if(u==="\\"){let d=b();if(d==="/"&&t.bash!==!0||d==="."||d===";")continue;if(!d){u+="\\",C({type:"text",value:u});continue}let x=/^\\+/.exec(J()),M=0;if(x&&x[0].length>2&&(M=x[0].length,l.index+=M,M%2!==0&&(u+="\\")),t.unescape===!0?u=V():u+=V(),l.brackets===0){C({type:"text",value:u});continue}}if(l.brackets>0&&(u!=="]"||o.value==="["||o.value==="[^")){if(t.posix!==!1&&u===":"){let d=o.value.slice(1);if(d.includes("[")&&(o.posix=!0,d.includes(":"))){let x=o.value.lastIndexOf("["),M=o.value.slice(0,x),j=o.value.slice(x+2),G=On[j];if(G){o.value=M+G,l.backtrack=!0,V(),!i.output&&a.indexOf(o)===1&&(i.output=_);continue}}}(u==="["&&b()!==":"||u==="-"&&b()==="]")&&(u=`\\${u}`),u==="]"&&(o.value==="["||o.value==="[^")&&(u=`\\${u}`),t.posix===!0&&u==="!"&&o.value==="["&&(u="^"),o.value+=u,Ee({value:u});continue}if(l.quotes===1&&u!=='"'){u=Y.escapeRegex(u),o.value+=u,Ee({value:u});continue}if(u==='"'){l.quotes=l.quotes===1?0:1,t.keepQuotes===!0&&C({type:"text",value:u});continue}if(u==="("){be("parens"),C({type:"paren",value:u});continue}if(u===")"){if(l.parens===0&&t.strictBrackets===!0)throw new SyntaxError(de("opening","("));let d=H[H.length-1];if(d&&l.parens===d.parens+1){Rr(H.pop());continue}C({type:"paren",value:u,output:l.parens?")":"\\)"}),oe("parens");continue}if(u==="["){if(t.nobracket===!0||!J().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));u=`\\${u}`}else be("brackets");C({type:"bracket",value:u});continue}if(u==="]"){if(t.nobracket===!0||o&&o.type==="bracket"&&o.value.length===1){C({type:"text",value:u,output:`\\${u}`});continue}if(l.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(de("opening","["));C({type:"text",value:u,output:`\\${u}`});continue}oe("brackets");let d=o.value.slice(1);if(o.posix!==!0&&d[0]==="^"&&!d.includes("/")&&(u=`/${u}`),o.value+=u,Ee({value:u}),t.literalBrackets===!1||Y.hasRegexChars(d))continue;let x=Y.escapeRegex(o.value);if(l.output=l.output.slice(0,-o.value.length),t.literalBrackets===!0){l.output+=x,o.value=x;continue}o.value=`(${c}${x}|${o.value})`,l.output+=o.value;continue}if(u==="{"&&t.nobrace!==!0){be("braces");let d={type:"brace",value:u,output:"(",outputIndex:l.output.length,tokensIndex:l.tokens.length};w.push(d),C(d);continue}if(u==="}"){let d=w[w.length-1];if(t.nobrace===!0||!d){C({type:"text",value:u,output:u});continue}let x=")";if(d.dots===!0){let M=a.slice(),j=[];for(let G=M.length-1;G>=0&&(a.pop(),M[G].type!=="brace");G--)M[G].type!=="dots"&&j.unshift(M[G].value);x=Bn(j,t),l.backtrack=!0}if(d.comma!==!0&&d.dots!==!0){let M=l.output.slice(0,d.outputIndex),j=l.tokens.slice(d.tokensIndex);d.value=d.output="\\{",u=x="\\}",l.output=M;for(let G of j)l.output+=G.output||G.value}C({type:"brace",value:u,output:x}),oe("braces"),w.pop();continue}if(u==="|"){H.length>0&&H[H.length-1].conditions++,C({type:"text",value:u});continue}if(u===","){let d=u,x=w[w.length-1];x&&B[B.length-1]==="braces"&&(x.comma=!0,d="|"),C({type:"comma",value:u,output:d});continue}if(u==="/"){if(o.type==="dot"&&l.index===l.start+1){l.start=l.index+1,l.consumed="",l.output="",a.pop(),o=i;continue}C({type:"slash",value:u,output:$});continue}if(u==="."){if(l.braces>0&&o.type==="dot"){o.value==="."&&(o.output=R);let d=w[w.length-1];o.type="dots",o.output+=u,o.value+=u,d.dots=!0;continue}if(l.braces+l.parens===0&&o.type!=="bos"&&o.type!=="slash"){C({type:"text",value:u,output:R});continue}C({type:"dot",value:u,output:R});continue}if(u==="?"){if(!(o&&o.value==="(")&&t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("qmark",u);continue}if(o&&o.type==="paren"){let x=b(),M=u;if(x==="<"&&!Y.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(o.value==="("&&!/[!=<:]/.test(x)||x==="<"&&!/<([!=]|\w+>)/.test(J()))&&(M=`\\${u}`),C({type:"text",value:u,output:M});continue}if(t.dot!==!0&&(o.type==="slash"||o.type==="bos")){C({type:"qmark",value:u,output:z});continue}C({type:"qmark",value:u,output:L});continue}if(u==="!"){if(t.noextglob!==!0&&b()==="("&&(b(2)!=="?"||!/[!=<:]/.test(b(3)))){xe("negate",u);continue}if(t.nonegate!==!0&&l.index===0){mr();continue}}if(u==="+"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("plus",u);continue}if(o&&o.value==="("||t.regex===!1){C({type:"plus",value:u,output:f});continue}if(o&&(o.type==="bracket"||o.type==="paren"||o.type==="brace")||l.parens>0){C({type:"plus",value:u});continue}C({type:"plus",value:f});continue}if(u==="@"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){C({type:"at",extglob:!0,value:u,output:""});continue}C({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);let d=Nn.exec(J());d&&(u+=d[0],l.index+=d[0].length),C({type:"text",value:u});continue}if(o&&(o.type==="globstar"||o.star===!0)){o.type="star",o.star=!0,o.value+=u,o.output=k,l.backtrack=!0,l.globstar=!0,X(u);continue}let A=J();if(t.noextglob!==!0&&/^\([^?]/.test(A)){xe("star",u);continue}if(o.type==="star"){if(t.noglobstar===!0){X(u);continue}let d=o.prev,x=d.prev,M=d.type==="slash"||d.type==="bos",j=x&&(x.type==="star"||x.type==="globstar");if(t.bash===!0&&(!M||A[0]&&A[0]!=="/")){C({type:"star",value:u,output:""});continue}let G=l.braces>0&&(d.type==="comma"||d.type==="brace"),Ie=H.length&&(d.type==="pipe"||d.type==="paren");if(!M&&d.type!=="paren"&&!G&&!Ie){C({type:"star",value:u,output:""});continue}for(;A.slice(0,3)==="/**";){let Ce=e[l.index+4];if(Ce&&Ce!=="/")break;A=A.slice(3),X("/**",3)}if(d.type==="bos"&&P()){o.type="globstar",o.value+=u,o.output=K(t),l.output=o.output,l.globstar=!0,X(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&!j&&P()){l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=K(t)+(t.strictSlashes?")":"|$)"),o.value+=u,l.globstar=!0,l.output+=d.output+o.output,X(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&A[0]==="/"){let Ce=A[1]!==void 0?"|$":"";l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=`${K(t)}${$}|${$}${Ce})`,o.value+=u,l.output+=d.output+o.output,l.globstar=!0,X(u+V()),C({type:"slash",value:"/",output:""});continue}if(d.type==="bos"&&A[0]==="/"){o.type="globstar",o.value+=u,o.output=`(?:^|${$}|${K(t)}${$})`,l.output=o.output,l.globstar=!0,X(u+V()),C({type:"slash",value:"/",output:""});continue}l.output=l.output.slice(0,-o.output.length),o.type="globstar",o.output=K(t),o.value+=u,l.output+=o.output,l.globstar=!0,X(u);continue}let O={type:"star",value:u,output:k};if(t.bash===!0){O.output=".*?",(o.type==="bos"||o.type==="slash")&&(O.output=g+O.output),C(O);continue}if(o&&(o.type==="bracket"||o.type==="paren")&&t.regex===!0){O.output=u,C(O);continue}(l.index===l.start||o.type==="slash"||o.type==="dot")&&(o.type==="dot"?(l.output+=S,o.output+=S):t.dot===!0?(l.output+=T,o.output+=T):(l.output+=g,o.output+=g),b()!=="*"&&(l.output+=_,o.output+=_)),C(O)}for(;l.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));l.output=Y.escapeLast(l.output,"["),oe("brackets")}for(;l.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing",")"));l.output=Y.escapeLast(l.output,"("),oe("parens")}for(;l.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","}"));l.output=Y.escapeLast(l.output,"{"),oe("braces")}if(t.strictSlashes!==!0&&(o.type==="star"||o.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${$}?`}),l.backtrack===!0){l.output="";for(let A of l.tokens)l.output+=A.output!=null?A.output:A.value,A.suffix&&(l.output+=A.suffix)}return l};Vt.fastpaths=(e,r)=>{let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);e=zt[e]||e;let i=Y.isWindows(r),{DOT_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOTS:R,NO_DOTS_SLASH:f,STAR:$,START_ANCHOR:_}=ke.globChars(i),y=t.dot?R:h,E=t.dot?f:h,S=t.capture?"":"?:",T={negated:!1,prefix:""},L=t.bash===!0?".*?":$;t.capture&&(L=`(${L})`);let z=g=>g.noglobstar===!0?L:`(${S}(?:(?!${_}${g.dot?m:a}).)*?)`,I=g=>{switch(g){case"*":return`${y}${p}${L}`;case".*":return`${a}${p}${L}`;case"*.*":return`${y}${L}${a}${p}${L}`;case"*/*":return`${y}${L}${c}${p}${E}${L}`;case"**":return y+z(t);case"**/*":return`(?:${y}${z(t)}${c})?${E}${p}${L}`;case"**/*.*":return`(?:${y}${z(t)}${c})?${E}${L}${a}${p}${L}`;case"**/.*":return`(?:${y}${z(t)}${c})?${a}${p}${L}`;default:{let v=/^(.*?)\.(\w+)$/.exec(g);if(!v)return;let k=I(v[1]);return k?k+a+v[2]:void 0}}},re=Y.removePrefix(e,T),K=I(re);return K&&t.strictSlashes!==!0&&(K+=`${c}?`),K};Jt.exports=Vt});var rr=q((ls,tr)=>{"use strict";var Pn=W("path"),Mn=Yt(),Ze=er(),Ye=Re(),Dn=me(),Un=e=>e&&typeof e=="object"&&!Array.isArray(e),D=(e,r,t=!1)=>{if(Array.isArray(e)){let h=e.map(f=>D(f,r,t));return f=>{for(let $ of h){let _=$(f);if(_)return _}return!1}}let n=Un(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=r||{},i=Ye.isWindows(r),a=n?D.compileRe(e,r):D.makeRe(e,r,!1,!0),c=a.state;delete a.state;let p=()=>!1;if(s.ignore){let h={...r,ignore:null,onMatch:null,onResult:null};p=D(s.ignore,h,t)}let m=(h,R=!1)=>{let{isMatch:f,match:$,output:_}=D.test(h,a,r,{glob:e,posix:i}),y={glob:e,state:c,regex:a,posix:i,input:h,output:_,match:$,isMatch:f};return typeof s.onResult=="function"&&s.onResult(y),f===!1?(y.isMatch=!1,R?y:!1):p(h)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,R?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),R?y:!0)};return t&&(m.state=c),m};D.test=(e,r,t,{glob:n,posix:s}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let i=t||{},a=i.format||(s?Ye.toPosixSlashes:null),c=e===n,p=c&&a?a(e):e;return c===!1&&(p=a?a(e):e,c=p===n),(c===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?c=D.matchBase(e,r,t,s):c=r.exec(p)),{isMatch:Boolean(c),match:c,output:p}};D.matchBase=(e,r,t,n=Ye.isWindows(t))=>(r instanceof RegExp?r:D.makeRe(r,t)).test(Pn.basename(e));D.isMatch=(e,r,t)=>D(r,t)(e);D.parse=(e,r)=>Array.isArray(e)?e.map(t=>D.parse(t,r)):Ze(e,{...r,fastpaths:!1});D.scan=(e,r)=>Mn(e,r);D.compileRe=(e,r,t=!1,n=!1)=>{if(t===!0)return e.output;let s=r||{},i=s.contains?"":"^",a=s.contains?"":"$",c=`${i}(?:${e.output})${a}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let p=D.toRegex(c,r);return n===!0&&(p.state=e),p};D.makeRe=(e,r={},t=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(s.output=Ze.fastpaths(e,r)),s.output||(s=Ze(e,r)),D.compileRe(s,r,t,n)};D.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===!0)throw t;return/$^/}};D.constants=Dn;tr.exports=D});var sr=q((fs,nr)=>{"use strict";nr.exports=rr()});var cr=q((ps,ur)=>{"use strict";var ir=W("util"),or=Pt(),ae=sr(),ze=Re(),ar=e=>e===""||e==="./",N=(e,r,t)=>{r=[].concat(r),e=[].concat(e);let n=new Set,s=new Set,i=new Set,a=0,c=h=>{i.add(h.output),t&&t.onResult&&t.onResult(h)};for(let h=0;h!n.has(h));if(t&&m.length===0){if(t.failglob===!0)throw new Error(`No matches found for "${r.join(", ")}"`);if(t.nonull===!0||t.nullglob===!0)return t.unescape?r.map(h=>h.replace(/\\/g,"")):r}return m};N.match=N;N.matcher=(e,r)=>ae(e,r);N.isMatch=(e,r,t)=>ae(r,t)(e);N.any=N.isMatch;N.not=(e,r,t={})=>{r=[].concat(r).map(String);let n=new Set,s=[],a=N(e,r,{...t,onResult:c=>{t.onResult&&t.onResult(c),s.push(c.output)}});for(let c of s)a.includes(c)||n.add(c);return[...n]};N.contains=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);if(Array.isArray(r))return r.some(n=>N.contains(e,n,t));if(typeof r=="string"){if(ar(e)||ar(r))return!1;if(e.includes(r)||e.startsWith("./")&&e.slice(2).includes(r))return!0}return N.isMatch(e,r,{...t,contains:!0})};N.matchKeys=(e,r,t)=>{if(!ze.isObject(e))throw new TypeError("Expected the first argument to be an object");let n=N(Object.keys(e),r,t),s={};for(let i of n)s[i]=e[i];return s};N.some=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(n.some(a=>i(a)))return!0}return!1};N.every=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(!n.every(a=>i(a)))return!1}return!0};N.all=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);return[].concat(r).every(n=>ae(n,t)(e))};N.capture=(e,r,t)=>{let n=ze.isWindows(t),i=ae.makeRe(String(e),{...t,capture:!0}).exec(n?ze.toPosixSlashes(r):r);if(i)return i.slice(1).map(a=>a===void 0?"":a)};N.makeRe=(...e)=>ae.makeRe(...e);N.scan=(...e)=>ae.scan(...e);N.parse=(e,r)=>{let t=[];for(let n of[].concat(e||[]))for(let s of or(String(n),r))t.push(ae.parse(s,r));return t};N.braces=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return r&&r.nobrace===!0||!/\{.*\}/.test(e)?[e]:or(e,r)};N.braceExpand=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return N.braces(e,{...r,expand:!0})};ur.exports=N});var fr=q((hs,lr)=>{"use strict";lr.exports=(e,...r)=>new Promise(t=>{t(e(...r))})});var hr=q((ds,Ve)=>{"use strict";var Gn=fr(),pr=e=>{if(e<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let r=[],t=0,n=()=>{t--,r.length>0&&r.shift()()},s=(c,p,...m)=>{t++;let h=Gn(c,...m);p(h),h.then(n,n)},i=(c,p,...m)=>{tnew Promise(m=>i(c,m,...p));return Object.defineProperties(a,{activeCount:{get:()=>t},pendingCount:{get:()=>r.length}}),a};Ve.exports=pr;Ve.exports.default=pr});var jn={};Cr(jn,{default:()=>Wn});var Se=W("@yarnpkg/cli"),ne=W("@yarnpkg/core"),et=W("@yarnpkg/core"),ue=W("clipanion"),ce=class extends Se.BaseCommand{constructor(){super(...arguments);this.json=ue.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=ue.Option.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=ue.Option.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=ue.Option.Rest()}async execute(){let t=await ne.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ne.Project.find(t,this.context.cwd),i=await ne.Cache.find(t);await n.restoreInstallState({restoreResolutions:!1});let a;if(this.all)a=new Set(n.workspaces);else if(this.workspaces.length===0){if(!s)throw new Se.WorkspaceRequiredError(n.cwd,this.context.cwd);a=new Set([s])}else a=new Set(this.workspaces.map(p=>n.getWorkspaceByIdent(et.structUtils.parseIdent(p))));for(let p of a)for(let m of this.production?["dependencies"]:ne.Manifest.hardDependencies)for(let h of p.manifest.getForScope(m).values()){let R=n.tryWorkspaceByDescriptor(h);R!==null&&a.add(R)}for(let p of n.workspaces)a.has(p)?this.production&&p.manifest.devDependencies.clear():(p.manifest.installConfig=p.manifest.installConfig||{},p.manifest.installConfig.selfReferences=!1,p.manifest.dependencies.clear(),p.manifest.devDependencies.clear(),p.manifest.peerDependencies.clear(),p.manifest.scripts.clear());return(await ne.StreamReport.start({configuration:t,json:this.json,stdout:this.context.stdout,includeLogs:!0},async p=>{await n.install({cache:i,report:p,persistProject:!1})})).exitCode()}};ce.paths=[["workspaces","focus"]],ce.usage=ue.Command.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "});var Ne=W("@yarnpkg/cli"),ge=W("@yarnpkg/core"),_e=W("@yarnpkg/core"),F=W("@yarnpkg/core"),gr=W("@yarnpkg/plugin-git"),U=W("clipanion"),Oe=Be(cr()),Ar=Be(hr()),te=Be(W("typanion")),pe=class extends Ne.BaseCommand{constructor(){super(...arguments);this.recursive=U.Option.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.from=U.Option.Array("--from",[],{description:"An array of glob pattern idents from which to base any recursion"});this.all=U.Option.Boolean("-A,--all",!1,{description:"Run the command on all workspaces of a project"});this.verbose=U.Option.Boolean("-v,--verbose",!1,{description:"Prefix each output line with the name of the originating workspace"});this.parallel=U.Option.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=U.Option.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=U.Option.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:te.isOneOf([te.isEnum(["unlimited"]),te.applyCascade(te.isNumber(),[te.isInteger(),te.isAtLeast(1)])])});this.topological=U.Option.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=U.Option.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=U.Option.Array("--include",[],{description:"An array of glob pattern idents; only matching workspaces will be traversed"});this.exclude=U.Option.Array("--exclude",[],{description:"An array of glob pattern idents; matching workspaces won't be traversed"});this.publicOnly=U.Option.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=U.Option.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.commandName=U.Option.String();this.args=U.Option.Proxy()}async execute(){let t=await ge.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ge.Project.find(t,this.context.cwd);if(!this.all&&!s)throw new Ne.WorkspaceRequiredError(n.cwd,this.context.cwd);await n.restoreInstallState();let i=this.cli.process([this.commandName,...this.args]),a=i.path.length===1&&i.path[0]==="run"&&typeof i.scriptName<"u"?i.scriptName:null;if(i.path.length===0)throw new U.UsageError("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let c=this.all?n.topLevelWorkspace:s,p=this.since?Array.from(await gr.gitUtils.fetchChangedWorkspaces({ref:this.since,project:n})):[c,...this.from.length>0?c.getRecursiveWorkspaceChildren():[]],m=g=>Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.from),h=this.from.length>0?p.filter(m):p,R=new Set([...h,...h.map(g=>[...this.recursive?this.since?g.getRecursiveWorkspaceDependents():g.getRecursiveWorkspaceDependencies():g.getRecursiveWorkspaceChildren()]).flat()]),f=[],$=!1;if(a!=null&&a.includes(":")){for(let g of n.workspaces)if(g.manifest.scripts.has(a)&&($=!$,$===!1))break}for(let g of R)a&&!g.manifest.scripts.has(a)&&!$&&!(await ge.scriptUtils.getWorkspaceAccessibleBinaries(g)).has(a)||a===process.env.npm_lifecycle_event&&g.cwd===s.cwd||this.include.length>0&&!Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.include)||this.exclude.length>0&&Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.exclude)||this.publicOnly&&g.manifest.private===!0||f.push(g);let _=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(F.nodeUtils.availableParallelism()/2):1,y=_===1?!1:this.parallel,E=y?this.interlaced:!0,S=(0,Ar.default)(_),T=new Map,L=new Set,z=0,I=null,re=!1,K=await _e.StreamReport.start({configuration:t,stdout:this.context.stdout,includePrefix:!1},async g=>{let v=async(k,{commandIndex:l})=>{if(re)return-1;!y&&this.verbose&&l>1&&g.reportSeparator();let H=qn(k,{configuration:t,verbose:this.verbose,commandIndex:l}),[w,B]=dr(g,{prefix:H,interlaced:E}),[o,u]=dr(g,{prefix:H,interlaced:E});try{this.verbose&&g.reportInfo(null,`${H} Process started`);let P=Date.now(),b=await this.cli.run([this.commandName,...this.args],{cwd:k.cwd,stdout:w,stderr:o})||0;w.end(),o.end(),await B,await u;let V=Date.now();if(this.verbose){let J=t.get("enableTimers")?`, completed in ${F.formatUtils.pretty(t,V-P,F.formatUtils.Type.DURATION)}`:"";g.reportInfo(null,`${H} Process exited (exit code ${b})${J}`)}return b===130&&(re=!0,I=b),b}catch(P){throw w.end(),o.end(),await B,await u,P}};for(let k of f)T.set(k.anchoredLocator.locatorHash,k);for(;T.size>0&&!g.hasErrors();){let k=[];for(let[w,B]of T){if(L.has(B.anchoredDescriptor.descriptorHash))continue;let o=!0;if(this.topological||this.topologicalDev){let u=this.topologicalDev?new Map([...B.manifest.dependencies,...B.manifest.devDependencies]):B.manifest.dependencies;for(let P of u.values()){let b=n.tryWorkspaceByDescriptor(P);if(o=b===null||!T.has(b.anchoredLocator.locatorHash),!o)break}}if(!!o&&(L.add(B.anchoredDescriptor.descriptorHash),k.push(S(async()=>{let u=await v(B,{commandIndex:++z});return T.delete(w),L.delete(B.anchoredDescriptor.descriptorHash),u})),!y))break}if(k.length===0){let w=Array.from(T.values()).map(B=>F.structUtils.prettyLocator(t,B.anchoredLocator)).join(", ");g.reportError(_e.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected (${w})`);return}let H=(await Promise.all(k)).find(w=>w!==0);I===null&&(I=typeof H<"u"?1:I),(this.topological||this.topologicalDev)&&typeof H<"u"&&g.reportError(_e.MessageName.UNNAMED,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return I!==null?I:K.exitCode()}};pe.paths=[["workspaces","foreach"]],pe.usage=U.Command.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n Adding the `-v,--verbose` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish current and all descendant packages","yarn workspaces foreach npm publish --tolerate-republish"],["Run build script on current and all descendant packages","yarn workspaces foreach run build"],["Run build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -pt run build"],["Run build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -ptR --from '{workspace-a,workspace-b}' run build"]]});function dr(e,{prefix:r,interlaced:t}){let n=e.createStreamReporter(r),s=new F.miscUtils.DefaultStream;s.pipe(n,{end:!1}),s.on("finish",()=>{n.end()});let i=new Promise(c=>{n.on("finish",()=>{c(s.active)})});if(t)return[s,i];let a=new F.miscUtils.BufferStream;return a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()}),[a,i]}function qn(e,{configuration:r,commandIndex:t,verbose:n}){if(!n)return null;let i=`[${F.structUtils.stringifyIdent(e.locator)}]:`,a=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],c=a[t%a.length];return F.formatUtils.pretty(r,i,c)}var Kn={commands:[ce,pe]},Wn=Kn;return wr(jn);})(); +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ +/*! + * to-regex-range + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + */ +return plugin; +} +}; diff --git a/.yarnrc.yml b/.yarnrc.yml index b213782c..ac5fb3f0 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,2 +1,7 @@ nodeLinker: node-modules -npmRegistryServer: 'https://registry.npmmirror.com' + +npmRegistryServer: "https://registry.npmmirror.com" + +plugins: + - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs + spec: "@yarnpkg/plugin-workspace-tools" diff --git a/package.json b/package.json index f1284a04..00eb2110 100644 --- a/package.json +++ b/package.json @@ -6,18 +6,17 @@ "author": "Linkontoask", "description": "Cross-platform copyright-free music platform", "scripts": { - "bootstrap": "npx lerna@3.22.1 bootstrap", + "bootstrap": "yarn workspaces foreach install", "dev": "concurrently -r \"yarn dev:api\" \"yarn generate:theme\" \"yarn dev:web\"", "dev:web": "cross-env NODE_ENV=development vite --mode browser", - "dev:api": "lerna exec --scope @radishes/api -- yarn run dev", + "dev:api": "yarn workspace @radishes/api run dev", "dev:electron": "concurrently -r \"yarn generate:theme\" \"electron-vite dev --mode electron.dev --outDir dist-electron\"", - "build": "cross-env NODE_ENV=production vite build --mode browser", - "build:electron": "npx electron-vite build --mode electron.build --outDir dist-electron", - "build:electron:win": "node script/build.js --win", - "build:electron:linux": "node script/build.js --linux", - "build:electron:macos": "node script/build.js --mac", - "build:api": "lerna exec --scope @radishes/api -- yarn run build", - "pkg": "npx rimraf dist-electron && yarn build:electron && npx electron-builder --config .electron-builder.config.js", + "build:web": "yarn generate:theme && cross-env NODE_ENV=production vite build --mode browser", + "build:electron": "npx rimraf dist-electron && npx electron-vite build --mode electron.build --outDir dist-electron", + "build:api": "yarn workspace @radishes/api run build", + "pkg:win": "yarn build:electron && yarn workspace @radishes/api run buildwin && npx electron-builder --config .electron-builder.config.js -w", + "pkg:linux": "yarn build:electron && yarn workspace @radishes/api run buildlinux && npx electron-builder --config .electron-builder.config.js -l", + "pkg:macos": "yarn build:electron && yarn workspace @radishes/api run buildmacos && npx electron-builder --config .electron-builder.config.js -m", "test": "lerna run test --stream", "test:unit": "vue-cli-service test:unit", "test:open": "cypress open", diff --git a/packages/api b/packages/api new file mode 160000 index 00000000..a4d5282a --- /dev/null +++ b/packages/api @@ -0,0 +1 @@ +Subproject commit a4d5282a32dfe18c95d2df798f75ef4e782828fa diff --git a/packages/api/.editorconfig b/packages/api/.editorconfig deleted file mode 100644 index 6c725cea..00000000 --- a/packages/api/.editorconfig +++ /dev/null @@ -1,34 +0,0 @@ - -# EditorConfig is awesome: http://EditorConfig.org - -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -insert_final_newline = true - -# Matches multiple files with brace expansion notation -# Set default charset -[*.{js,py}] -charset = utf-8 - -# 4 space indentation -[*.py] -indent_style = space -indent_size = 4 - -# Tab indentation (no size specified) -[Makefile] -indent_style = tab - -# Indentation override for all JS under lib directory -[*.{js,ts}] -indent_style = space -indent_size = 2 - -# Matches the exact files either package.json or .travis.yml -[{package.json,.travis.yml}] -indent_style = space -indent_size = 2 \ No newline at end of file diff --git a/packages/api/.eslintrc.js b/packages/api/.eslintrc.js deleted file mode 100644 index 2a54cd0c..00000000 --- a/packages/api/.eslintrc.js +++ /dev/null @@ -1,50 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - parser: 'babel-eslint', - ecmaVersion: 2018, - sourceType: 'module', - }, - plugins: ['html'], - extends: ['plugin:prettier/recommended'], - env: { - browser: true, - node: true, - }, - - rules: { - indent: ['error', 2, { SwitchCase: 1 }], - 'space-infix-ops': ['error', { int32Hint: false }], - 'key-spacing': [ - 2, - { - beforeColon: false, - afterColon: true, - }, - ], - 'no-octal': 2, - 'no-redeclare': 2, - 'comma-spacing': 2, - 'no-new-object': 2, - 'arrow-spacing': 2, - quotes: [ - 2, - 'single', - { - avoidEscape: true, - allowTemplateLiterals: true, - }, - ], - 'prettier/prettier': 'off', - }, - overrides: [ - { - files: ['**/*.ts'], - parser: '@typescript-eslint/parser', - extends: [ - 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin - 'prettier/@typescript-eslint', - ], - }, - ], -} diff --git a/packages/api/.gitignore b/packages/api/.gitignore deleted file mode 100644 index 91eabde1..00000000 --- a/packages/api/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -node_modules -*.log -.idea -.vscode -.vercel diff --git a/packages/api/.npmignore b/packages/api/.npmignore deleted file mode 100644 index 3f24434d..00000000 --- a/packages/api/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -static -docs -node_modules \ No newline at end of file diff --git a/packages/api/.prettierrc b/packages/api/.prettierrc deleted file mode 100644 index 05c968c0..00000000 --- a/packages/api/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "semi": false, - "trailingComma": "all", - "singleQuote": true -} diff --git a/packages/api/.travis.yml b/packages/api/.travis.yml deleted file mode 100644 index 6e728889..00000000 --- a/packages/api/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js - -node_js: - - 12 diff --git a/packages/api/CHANGELOG.MD b/packages/api/CHANGELOG.MD deleted file mode 100644 index da5788f5..00000000 --- a/packages/api/CHANGELOG.MD +++ /dev/null @@ -1,750 +0,0 @@ -# 更新日志 -### 4.0.9 | 2021.3.13 -- 新增一起听状态接口 [#1170](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1170) - -### 4.0.8 | 2021.2.27 -- 加入vercel 配置文件,支持 vercel 部署 - -### 4.0.7 | 2021.2.27 -- 更新红心接口,修复红心接口460错误问题 [#1151](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1151) - -- 更新发送验证码接口 - -- 注册接口添加 countrycode 参数 [#1152](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1152) - -- 新增绑定手机接口 [#1152](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1152) - -- 更新 song/detail 接口 [#1143](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1143) - -- 用户粉丝接口修改分页参数 [#1161](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1161) - -### 4.0.6 | 2021.2.20 -- 修复 eapi 接口无法正确解密response的问题 [#1138](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1138) - -### 4.0.5 | 2021.2.19 -- 修复红心接口默认不红心的问题 [#1126](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1126) - -### 4.0.4 | 2021.2.18 -- 移除云村热评接口(官方下架) [#1111](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1111) -- 更新 app version - -### 4.0.3 | 2021.1.28 -- 修复云盘接口中文音乐信息乱码的问题 [#1108](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1108) - -### 4.0.2 | 2021.1.18 -- 修复未绑定手机号对歌单添加或删除歌曲无响应的问题 [#1099](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1099) - -### 4.0.1 | 2021.1.09 -- 新增歌单详情动态接口 [#1088](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1088) - -### 4.0.0 | 2021.1.03 -- 新增云盘上传接口,新增二维码登录相关接口和相关demo(http://localhost:3000/qrlogin.html, http://localhost:3000/cloud.html),更新 d.ts - -- 升级部分接口加密方法("linuxapi" 都替换到了"api") - -- 更新 `login/status` 接口(返回字段和之前不一样) - -### 3.47.5 | 2020.12.20 -- 更新appver [#1060](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1060) - -### 3.47.4 | 2020.12.03 -- 修复收藏的专栏接口无法调用的问题 [#1042](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1042) - -### 3.47.3 | 2020.11.22 -- 新增歌手详情接口 [#1035](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1035) - -### 3.47.2 | 2020.11.15 -- 新增关注歌手新歌/新MV接口 [#1028](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1028) - -### 3.47.1 | 2020.11.14 -- 修复使用post请求取消喜欢音乐会失败的问题 [#1024](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1024) - -- 新增抱一抱评论和评论抱一抱列表接口 [#1016](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1016) - -- 新增收藏的专栏接口[#1026](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1026) - -### 3.46.1 | 2020.11.7 -- 修复私信音乐接口出现风险提示的问题 - -### 3.46.0 | 2020.11.7 -- 添加私信音乐接口 [#1016](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1016) - -- 添加最近联系人接口 - -- 修复用户动态数量不准确问题 [#1010](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1010) - -- 修复 cloudsearch 接口分页问题 [#1015](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1015) - -### 3.45.3 | 2020.11.1 -- `相似歌手`,`首页-发现-圆形图标入口列表`接口增加匿名token[#877](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/877) [#988](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/988) - -- 修复`音乐 url`接口POST方式手动传入cookie报错问题 [#1005](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1005) - -### 3.45.2 | 2020.10.26 -- 云贝完成任务接口增加`depositCode`参数 - -### 3.45.1 | 2020.10.25 -- 修复代理配置失效的问题 [#992](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/992) - -- 修复新碟上架不返回周数据的问题,修复推荐新音乐接口返回数量问题,并添加limit参数支持 [#981](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/981) - -- 添加`云贝`相关接口 [#985](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/985) - -- 添加`用户账号信息`接口 - -- 替换接口文件所有http url 为 https - -### 3.44.0 | 2020.10.17 -- 更新`电台详情`,`电台节目详情`接口 [#977](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/977) - -#### Breaking change -- `电台详情`接口更新后数据结构有变化 - -### 3.43.0 | 2020.10.16 -- 新增`电台订阅者列表`接口 [#971](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/971) - -### 3.42.4 | 2020.10.07 -- 修复新评论接口分页参数问题 - -### 3.42.3 | 2020.10.05 -- 修复新评论接口分页参数问题 - -### 3.42.2 | 2020.10.05 -- 更新歌单详情接口 - -### 3.42.1 | 2020.10.04 -- 新增`用户绑定信息`,`用户绑定手机`,`新版评论`,`点赞过的视频`,`收藏视频到视频歌单`,`删除视频歌单里的视频`,`最近播放的视频`,`音乐日历`等接口 - -- 创建歌单接口增加`type`参数,可创建视频歌单 - -### 3.41.2 | 2020.09.20 -- 更新`获取音乐 url`接口,未登录状态返回试听片段 [#897](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/897) - -### 3.41.1 | 2020.09.19 -- 新增`电台个性推荐接口` [#824](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/824) - -### 3.41.0 | 2020.09.19 -- 新增`精品歌单标签列表`接口 [#921](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/921) - -- 新增`用户等级信息`接口 [#929](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/929) - -- 增加新接口的 d.ts 文件,修复登录接口的 d.ts 的 countrycode 为非可选属性的错误 - -### 3.40.1 | 2020.09.13 -- 更新 TypeScript 声明 [#928](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/928) - -### 3.40.0 | 2020.09.12 -- 新增 TypeScript 声明文件 [#908](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/908) -- 更改随机 UA 相关逻辑[#922](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/922) - -### 3.39.0 | 2020.08.23 -- 新增`cloudsearch`接口[#893](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/893) -- `mv 地址`接口修改分辨率参数 [#883](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/883) -- 修复新碟上架接口分页问题 [#892](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/892) - -### 3.38.0 | 2020.08.09 -- 新增`楼层评论`,`歌手全部歌曲`接口 [#864](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/864) [#867](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/867) -- 支持收藏VIP或付费歌曲到歌单 [#860](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/860) -- 支持手动传入`realIP` [#863](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/863) - -### 3.37.2 | 2020.08.04 -- 修复依赖问题 - -### 3.37.0 | 2020.08.03 -- 新增`更新头像`,`歌单封面上传`接口和相关例子 [#403](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/403) [#857](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/857) -- 加入`axios`依赖 - -### 3.36.0 | 2020.07.26 -- 新增`全部新碟`,`数字专辑-新碟上架`,`数字专辑&数字单曲-榜单`,`数字专辑-语种风格馆`,`数字专辑详情`接口 [#852](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/852) -- 更新`新碟上架`接口,修改传入参数,返回数据结构有变化 - -### 3.35.0 | 2020.07.18 -- 新增`首页-发现`,`首页-发现-圆形图标入口列表`接口 [#851](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/851) - -### 3.34.2 | 2020.07.13 -- 修复`获取用户播放记录`接口参数错误问题 [#849](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/849) - -- 增加`国家编码列表`接口 [#841](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/841) - -### 3.34.1 | 2020.07.06 -- 登录接口增加 `md5_password` 参数 [#839](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/839) - -### 3.34.0 | 2020.06.25 -- 排行榜接口废弃idx参数,只支持id参数,修复返回数据异常问题 [#830](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/830) -- 新增`获取历史日推可用日期列表`,`获取历史日推详细数据` 接口 - -### 3.33.2 | 2020.06.23 -- 更新每日推荐接口 [#826](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/826) - -### 3.33.1 | 2020.06.15 -- 修复直接调用时传入 cookie 不生效的问题 [#822](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/822) - -### 3.33.0 | 2020.06.10 -- 歌手榜支持地区参数 [#818](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/818) -- 新增视频分类列表,推荐视频,获取全部视频列表接口 [#816](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/816) -- 内置 apicache,修复不能在 NodeJS v13 版本使用的问题 [#817](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/817) - -### 3.32.3 | 2020.06.07 -- 修复 Nodejs 下 cookie 使用格式问题 [#812](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/812) - -### 3.32.2 | 2020.06.05 -- 新增独家放送列表接口 [#808](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/808) - -### 3.32.1 | 2020.06.03 -- 新增歌曲排序接口 - -### 3.32.0 | 2020.06.03 -- 更新排行榜接口,支持传入榜单id -- 新增榜单顺序调整接口 [#806](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/806) -- 完善错误提示信息 - -### 3.31.1 | 2020.05.19 -- 修复`cookie`没返回的问题 [#778](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/778) - -### 3.31.0 | 2020.05.18 -- 支持 `Node.js` 调用,参考`module_example` 文件夹下的 `test.js` - -### 3.30.0 | 2020.05.17 -- 登录接口返回内容增加`cookie`字段,支持手动传入cookie - -### 3.29.1 | 2020.05.13 -- 调整通知接口分页参数 [#761](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/761) - -### 3.29.0 | 2020.05.11 -- 支持批量删除歌单 [#760](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/760) - -### 3.28.0 | 2020.05.05 -- 新增获取 mv 点赞转发评论数数据接口 -- 新增获取视频点赞转发评论数数据接口 - -### 3.27.0 | 2020.04.20 -- 新增购买专辑接口 by [TimonPeng](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/740) - -### 3.26.0 | 2020.04.08 -#### Breaking change -- 更新歌手分类列表接口参数,因`cat`参数失效,调整为`type`和`area`参数 - -### 3.25.4 | 2020.03.18 -- 更新歌词,歌手分类列表接口 - -- 更新文档 - -### 3.25.3 | 2019.11.08 -- 升级依赖,去除多余依赖 - -- 优化 `test.html` - -### 3.25.2 | 2019.11.07 -- 修复邮箱登录状态码错误,增加相关提示 [#633](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/633) - -### 3.25.0 | 2019.11.06 -- 新增 `云村热评` 接口[#626](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/626) - -- 新增 `歌手热门50首歌曲` 接口 - -- 新增`电台24小时节目榜`,`电台24小时主播榜`, `电台最热主播榜`,`电台主播新人榜`,`电台付费精品榜` 接口 [#606](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/606) - -- 调整 `歌手分类列表 ` 接口参数 [#624](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/624) - -### 3.24.2 | 2019.10.28 -- 修改默认绑定 HOST [#620](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/620) - -### 3.24.1 | 2019.10.25 -- 修改默认绑定 HOST [#615](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/615) - -### 3.24.0 | 2019.10.22 -- 新增`类别热门电台` 接口 [#607](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/607) - -### 3.23.0 | 2019.10.16 -- 修复电台 banner 接口无数据问题[#601](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/601) - -- 更新排行榜 [#602](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/602) - -- 新增`电台排行榜`,`新晋电台榜`,`热门电台榜`接口 [#604](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/604) - -### 3.22.4 | 2019.09.26 -- 修复私信历史记录分页参数问题,更新文档 [#599](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/599) - -### 3.22.3 | 2019.09.24 -- 手机号码检测: 添加国家码作为参数,方便检测国外手机号码 [#598](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/598) - -### 3.22.2 | 2019.09.18 -- 排行榜参数更新,更新文档[#592](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/592) - -### 3.22.1 | 2019.09.12 -- 支持回复评论[#589](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/589) - - -### 3.22.0 | 2019.08.25 -- 支持 CORS 预检 [#564](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/564) [#578](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/578) - -### 3.21.1 | 2019.08.21 -- 修复推荐歌单和网易出品mv参数错误,更新文档 [#571](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/571) [#572](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/572) - -### 3.21.0 | 2019.08.20 -- 新增`歌单删除接口`[#570](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/570) - -### 3.20.0 | 2019.08.06 -- 新增`更新歌单描述`,`更新歌单名`,`更新歌单标签`,`默认搜索关键词` 接口,更新文档[#547](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/547) - -### 3.19.0 | 2019.07.24 -- 新增`检测手机号码是否已注册`和`初始化昵称`接口[#540](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/540) - -### 3.18.6 | 2019.07.15 -- 修复注册异常的问题 [#532](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/532) - -### 3.18.5 | 2019.07.14 -- 修复部分歌曲无法获得播放链接的问题 [#531](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/531) - -### 3.18.3 | 2019.07.04 -- 修复全部 mv`/mv/all` 接口分页参数错误的问题 [#524](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/524) - -### 3.18.2 | 2019.07.03 -- 修复听歌打卡接口 `/scrobble` 失效问题 - -### 3.18.1 | 2019.06.30 -- 评论接口增加 `before` 参数以获取超过5000条评论数据 [#521](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/521) - -- 修复 `/msg/comments` 传入参数和文档描述不一致问题 - - -### 3.18.0 | 2019.06.29 -- 新增 `更换绑定手机接口` - -#### Breaking change -1. 调整注册接口由 `/captch/register` 修改为 `/register/cellphone` - -2. 调整发送短信接口由 `/captch/sent` 修改为 `/captcha/sent` - -3. 调整短信验证接口由 `/captch/verify` 修改为 `/captcha/verify` - -### 3.17.0 | 2019.06.29 -- 新增 `专辑动态信息` `热搜列表(详细)` 接口,更新文档 - -### 3.16.0 | 2019.06.27 -- 新增 `收藏/取消收藏专辑` 接口 - -- 调整歌曲评论接口使用客户端版本接口 - -### 3.15.0 | 2019.06.16 -- 新增`获取视频标签列表`,`网易出品`,`全部mv`接口, `最新 mv` 和 `mv 排行` 接口加入地区参数,更新文档 - -### 3.14.0 | 2019.06.10 -- 获取用户粉丝列表接口修改请求参数,更新文档 - -### 3.13.1 | 2019.06.09 -- 修复获取用户粉丝列表接口只能获取1000个的问题 - -### 3.13.0 | 2019.05.19 -- 新增eapi算法 (via:[#491](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/491)) - -- 新增batch批量请求接口 (via:[#491](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/491)) - -- 用户动态增加分页参数 - -### 3.12.0 | 2019.05.10 -- 增加`私信内容、我的数字专辑`接口 - -### 3.11.0 | 2019.05.09 -- 增加`通知-私信、通知-评论、通知-@我、通知-通知、设置、云盘数据详情`接口 - -### 3.10.2 | 2019.05.09 -- 增加`分享歌曲、歌单、mv、电台、电台节目到动态`接口 - -### 3.10.1 | 2019.05.08 -- 增加转发动态接口 - -- 增加删除动态接口 - -### 3.9.0 | 2019.05.03 -- 新增 云盘歌曲删除, 热门话题, 电台 - 推荐类型, 电台 - 非热门类型, 电台 - 今日优选, 心动模式/智能播放等接口 - -- 更新文档:banner接口 增加 `type` 参数; 获取动态消息接口增加 `pagesize` 和 `lasttime` 参数; 电台 - 付费精选接口修改默认`limit`为 30 - -### 3.8.1 | 2019.04.24 -- 修复歌词接口出错问题 - -### 3.8.0 | 2019.04.14 -- 增加注册,发送验证码,校验验证码接口 via:[https://github.com/Binaryify/NeteaseCloudMusicApi/pull/460](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/460) @[KongValley](https://github.com/KongValley) - -### 3.7.1 | 2019.04.09 -- 修复登录460问题 - -### 3.7.0 | 2019.03.20 -- 修复喜欢音乐接口参数判断问题 - -- 增加歌单收藏者列表接口 - -### 3.6.0 | 2019.03.15 -- 调整动态评论获取接口 url,使之和其他评论获取接口更统一 - -### 3.5.0 | 2019.03.14 -- 增加获取动态评论接口 - -- 支持给动态点赞 - -- 支持给动态评论点赞 - -- 支持给动态发送/删除评论 - -### 3.4.0 | 2019.01.29 -- 增加已收藏专辑列表接口 - -### 3.3.0 | 2019.01.27 -- 增加视频标签下的视频获取接口 - -- 增加 pac 代理支持 - -### 3.2.0 | 2019.01.19 -- 增加获取首页新碟上架数据以及更新听歌排行 - -- 更新搜索建议接口 - -### 3.1.0 | 2019.01.06 -- 修复评论接口返回 460 Cheating 的问题 - -- 新增`已收藏MV`接口,更新文档 - -### 3.0.9 | 2018.12.15 -- 修复关注异常的问题 #399 - -### 3.0.8 | 2018.12.12 -- 更新文档 #386 #394 - -- 优化电台节目接口 - -### 3.0.7 | 2018.11.21 -- 修复歌单详情列表,排行榜,所有榜单失效的问题,更新文档 #380 #381 - -### 3.0.4 | 2018.11.15 -- 修复 `/song/url` 接口无法返回多个音乐数据的问题 - -### 3.0.3 | 2018.11.09 -- 修复取消喜欢歌曲失败问题 [#360](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/360) - -- 补充已喜欢音乐列表接口说明文档 [#370](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/370) - -- 默认关闭 debug 模式 [#365](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/365) - -- 更新 Dockerfile 文件 [#367](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/367) - - -### 3.0.1 | 2018.10.21 - -- 合并 PR([#351](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/351)) - -- 文档增加 `/top/song` 接口 - -- `/banner` 换成 linux api,返回结构有所变动 - -- `/check/music` 已知 bug 修复 - -### 3.0.0 | 2018.10.14 - -#### 整体 - -- 完善文档,增加之前没写进文档的接口说明 - -- 重写 createRequest 返回 Promise 对象 - -- 模块化路由 - -- 模块化, 剥离 res,req, 方便导出调用 - -- 增加 cookie-parser - -##### 参数修改 - -- `/song/detail` 增加多 id 支持 - -- `/toplist/detail` 移除参数 - -- `/resource/like` 增加参数 `type` - -- `/top/playlist/highquality` 增加分页参数 `before` - -##### 统一参数 - -- `/artist/sub` 与 `artist/unsub` 合并, 用`query.t` - -- `/follow` 中 `query.type` 换成 `query.t` - -- `/comment` 中 `query.action` 换成 `query.t` - -##### URL 重命名 - -- `/video` 改为 `video/url` - -- `/mv` 改为 `mv/detail` - -- `/music/url` 改为 `/song/url` - -##### 转发逻辑修改 - -- `/toplist/artist` 换成 weapi - -- `/mv/url` 去除了 pipe - -##### BUG 修复 - -- `/playlist/create`, `/playlist/update` 被判欺骗,增加 cookie - -##### 路由增删 - -- 删除 `/recommend/dislike` - -- 增加 `/video/sub` (收藏视频), `/mv/sub` (收藏 MV) - -- 增加 `/video/detail` (视频详情) - -- 增加 `/related/allvideo` (相关视频) - -### 2.20.5 | 2018.09.29 - -修复非法参数 403 #335, 修复代理错误 #334 - -### 2.20.4 | 2018.09.27 - -修复点赞失效的问题 - -### 2.20.3 | 2018.09.26 - -- 增加退出登录接口 -- 修正 /check/music 的检查逻辑 -- 优化 Cookies 设置 -- 重构单元测试 - - [by @nondanee](https://github.com/nondanee) - -- 增加 301 需要登录提示信息 - -- 更新文档 - -### 2.20.2 | 2018.09.22 - -增加热门评论和视频评论接口,更新文档 - -### 2.20.1 | 2018.09.17 - -优化版本检查功能 - -### 2.20.0 | 2018.09.06 - -新增版本检查功能 - -### 2.19.0 | 2018.08.29 - -新增获取视频数据接口,新增发送/删除评论接口,修复登录状态接口问题,完善文档 #301,感谢 @izhenyuls - -### 2.17.0 | 2018.08.28 - -新增登录状态查询接口 #302 ,完善文档,完善路由注册 #297 - -### 2.16.0 | 2018.08.09 - -- Fixed #288,#289,#290 - -解决歌曲 URL 请求被判 Cheating,修复私信接收异常 #291 - -### 2.15.0 | 2018.07.30 - -新增相关歌单推荐和付费精选接口,增加歌手列表接口按首字母索引查找参数 - -### 2.14.0 | 2018.07.03 - -修复无法使用邮箱问题 - -### 2.13.0 | 2018.06.05 - -增加自动注册路由的功能,简化路由注册逻辑 - -### 2.12.0 | 2018.05.27 - -更新文档,优化歌单详情接口 - -### 2.11.1 | 2018.05.24 - -更新文档,优化`/dj/program`接口 - -### 2.11.0 | 2018.05.21 - -增加收藏歌手列表&订阅电台列表 - -### 2.10.0 | 2018.05.17 - -歌单操作调整为批量操作 - -### 2.9.9 | 2018.05.16 - -Bug 修复 - -### 2.9.8 | 2018.05.10 - -新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口 - -### 2.9.6 | 2018.05.08 - -新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 - -### 2.9.4 | 2018.05.04 - -新增热搜接口,更新 banner 接口 - -### 2.9.2 | 2018.02.28 - -修复登录失败会崩溃的问题 - -### 2.9.1 | 2018.01.26 - -docker 构建文件的一些增强以及增加访问日志和调试输出 - -### 2.8.9 | 2018.01.24 - -修复歌单详情数据不完整的问题,更新依赖 - -### 2.8.8 | 2018.01.22 - -修复排行榜数据不完整的问题 , 优化部分代码 , 更新文档部分描述 - -### 2.8.6 | 2018.01.16 - -修复歌单详情接口数据不完整的问题 - -### 2.8.5 | 2018.01.16 - -修复评论点赞失败的问题 - -### 2.8.4 | 2018.01.15 - -优化 cookie 设置 - -### 2.8.3 | 2018.01.12 - -优化部分功能和文档 - -### 2.8.2 | 2018.01.05 - -增加 Dockerfile,支持以 Docker 容器模式运行 - -### 2.8.1 | 2018.01.04 - -添加了 proxy 功能 - -### 2.8.0 | 2018.01.04 - -用 'request' 重写了请求函数 - -### 2.7.9 | 2017.12.11 - -更新排行榜接口 , 新增云音乐 ACG 音乐榜 , 云音乐嘻哈榜 - -### 2.7.7 | 2017.11.27 - -更新 / 修复排行榜接口 , 更新 / 修复推荐歌单接口 - -### 2.7.7 | 2017.11.27 - -更新 / 修复排行榜接口 , 更新 / 修复推荐歌单接口 - -### 2.7.2 | 2017.9.7 - -修复搜索接口 offset 参数失效问题 - -### 2.7.0 | 2017.8.21 - -优化刷新登录代码 - -### 2.6.5 | 2017.7.16 - -优化 CORS 设置 - -### 2.6.4 | 2017.7.16 - -添加缓存机制和随机 UA 机制 感谢[@u3u](https://github.com/u3u) -[issue:77](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/77) 优化请求 -代码 感谢 [@huhuime](https://github.com/huhuime) -[issue:83](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/83) - -### 2.6.2 | 2017.7.16 - -修复垃圾桶接口 - -### 2.6.1 | 2017.7.16 - -修复红心接口 - -### 2.6.0 | 2017.6.25 - -修复签到接口 - -### 2.5.9 | 2017.6.14 - -增加启动说明页 - -### 2.5.8 | 2017.6.1 - -修复若干细节问题 - -### 2.5.7 | 2017.5.22 - -修复若干问题 - -### 2.5.6 | 2017.5.14 - -增加动态消息接口 - -### 2.5.5 | 2017.5.10 - -修复 mv 排行榜接口崩溃问题 - -### 2.5.4 | 2017.5.5 - -新增点赞接口 , 更新文档 - -### 2.5.3 | 2017.5.2 - -修复歌手单曲数据空白问题和文档获取歌手单曲 url 描述问题 , 更新文档 - -### 2.5.0 | 2017.4.29 - -增加 mv/ 专辑 / 歌单评论接口 , 增加云盘相关接口 , 增加获取用户动态 / 信息接口 , -增加关注 / 粉丝列表接口 , 增加收藏歌单接口 , 增加相似 mv/ 歌曲 / 用户接口 , 增加 -banner 接口 , 增加刷新登录接口 , 增加电台相关接口 , 补充评论接口 , 更新文档 - -### 2.4.6 | 2017.4.21 - -增加播放 mv 接口 , 更新文档 - -### 2.4.5 | 2017.4.20 - -增加歌手专辑 , 歌手单曲等接口 , 修复 /album 接口描述错误 , 更新文档 - -### 2.4.0 | 2017.4.20 - -增加歌单(网友精选碟 ), 新碟上架 , 热门歌手等接口 , 更新文档 - -### 2.3.4 | 2017.4.20 - -增加歌曲详情接口 , 更新文档 - -### 2.3.0 | 2017.4.15 - -增加排行榜接口 , 更新文档 - -### 2.2.0 |2017.4.14 - -增加私人 FM, 喜欢歌曲 , 垃圾桶 , 每日签到等接口 , 更新文档 - -### 2.1.3 | 2017.4.6 - -改善文档 - -### 2.1.0 | 2017.4.6 - -增加获取评论接口以及对应单元测试 , 增加更新日志 - -### 2.0.0 | 2017.4.1 - -版本升级到 2.0. 增加使用文档 , 完成项目重构 , 增加更完善的单元测试 , 升级 api 到 -v2+, 支持登录并获取用户信息和创建的歌单 , 可通过获取音乐 url 接口获取用户歌单里 -的的音乐 , 获取每日推荐歌单和每日推荐音乐 diff --git a/packages/api/Dockerfile b/packages/api/Dockerfile deleted file mode 100644 index 66913354..00000000 --- a/packages/api/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:lts-alpine - -WORKDIR /app -COPY . /app - -RUN rm -f package-lock.json \ - ; rm -rf .idea \ - ; rm -rf node_modules \ - ; npm config set registry "https://registry.npm.taobao.org/" \ - && npm install - -EXPOSE 3000 -CMD ["node", "app.js"] diff --git a/packages/api/LICENSE b/packages/api/LICENSE deleted file mode 100644 index facc240b..00000000 --- a/packages/api/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2016 Binaryify - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/packages/api/README.MD b/packages/api/README.MD deleted file mode 100644 index 4f259842..00000000 --- a/packages/api/README.MD +++ /dev/null @@ -1,339 +0,0 @@ -# 网易云音乐 API - -网易云音乐 Node.js API service - -

-Version -License -devDependencies -devDependencies - -

- -## 灵感来自 - -[disoul/electron-cloud-music](https://github.com/disoul/electron-cloud-music) - -[darknessomi/musicbox](https://github.com/darknessomi/musicbox) - -[sqaiyan/netmusic-node](https://github.com/sqaiyan/netmusic-node) - -[greats3an/pyncm](https://github.com/greats3an/pyncm) - - -## 环境要求 - -需要 NodeJS 8.12+ 环境 - -## 安装 - -```shell - -$ git clone git@github.com:Binaryify/NeteaseCloudMusicApi.git - -$ npm install -``` - -或者 -```shell -$ git clone https://github.com/Binaryify/NeteaseCloudMusicApi.git - -$ npm install -``` - -## 运行 - -```shell -$ node app.js -``` - -服务器启动默认端口为 3000,若不想使用 3000 端口,可使用以下命令: Mac/Linux - -```shell -$ PORT=4000 node app.js -``` - -windows 下使用 git-bash 或者 cmder 等终端执行以下命令: - -```shell -$ set PORT=4000 && node app.js -``` - -## Vercel 部署 -v4.0.8 加入了 Vercel 配置文件,可以直接在 Vercel 下部署了,不需要自己的服务器 -### 操作方法 -1. fork 此项目 -2. 在 Vercel 官网点击 `New Project` -3. 点击 `Import Git Repository` 并选择你 fork 的此项目并点击`import` -4. 点击 `PERSONAL ACCOUNT` 的 `select` -5. 直接点`Continue` -6. `PROJECT NAME`自己填,`FRAMEWORK PRESET` 选 `Other` 然后直接点 `Deploy` 接着等部署完成即可 - -## 可以在Node.js调用 -v3.31.0后支持Node.js调用,导入的方法为`module`内的文件名,返回内容包含`status`和`body`,`status`为状态码,`body`为请求返回内容,参考`module_example` 文件夹下的 `test.js` -```js -const { login_cellphone, user_cloud } = require('NeteaseCloudMusicApi') -async function main() { - try { - const result = await login_cellphone({ - phone: '手机号', - password: '密码' - }) - console.log(result) - const result2 = await user_cloud({ - cookie: result.body.cookie // 凭证 - }) - console.log(result2.body) - - } catch (error) { - console.log(error) - } -} -main() -``` - -## 支持 TypeScript -```ts -// test.ts -import { banner } from 'NeteaseCloudMusicApi' -banner({ type:0 }).then(res=>{ - console.log(res) -}) -``` - - -## 使用文档 - -[文档地址](https://binaryify.github.io/NeteaseCloudMusicApi) - -[文档地址2](https://neteasecloudmusicapi.vercel.app) - -![文档](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/docs.png) - - -## 功能特性 -1. 登录 -2. 刷新登录 -3. 发送验证码 -4. 校验验证码 -5. 注册(修改密码) -6. 获取用户信息 , 歌单,收藏,mv, dj 数量 -7. 获取用户歌单 -8. 获取用户电台 -9. 获取用户关注列表 -10. 获取用户粉丝列表 -11. 获取用户动态 -12. 获取用户播放记录 -13. 获取精品歌单 -14. 获取歌单详情 -15. 搜索 -16. 搜索建议 -17. 获取歌词 -18. 歌曲评论 -19. 收藏单曲到歌单 -20. 专辑评论 -21. 歌单评论 -22. mv 评论 -23. 电台节目评论 -24. banner -25. 获取歌曲详情 -26. 获取专辑内容 -27. 获取歌手单曲 -28. 获取歌手 mv -29. 获取歌手专辑 -30. 获取歌手描述 -31. 获取相似歌手 -32. 获取相似歌单 -33. 相似 mv -34. 获取相似音乐 -35. 获取最近 5 个听了这首歌的用户 -36. 获取每日推荐歌单 -37. 获取每日推荐歌曲 -38. 私人 FM -39. 签到 -40. 喜欢音乐 -41. 垃圾桶 -42. 歌单 ( 网友精选碟 ) -43. 新碟上架 -44. 热门歌手 -45. 最新 mv -46. 推荐 mv -47. 推荐歌单 -48. 推荐新音乐 -49. 推荐电台 -50. 推荐节目 -51. 独家放送 -52. mv 排行 -53. 获取 mv 数据 -54. 播放 mv/视频 -55. 排行榜 -56. 歌手榜 -57. 云盘 -58. 电台 - 推荐 -59. 电台 - 分类 -60. 电台 - 分类推荐 -61. 电台 - 订阅 -62. 电台 - 详情 -63. 电台 - 节目 -64. 给评论点赞 -65. 获取动态 -66. 热搜列表(简略) -67. 发送私信 -68. 发送私信歌单 -69. 新建歌单 -70. 收藏/取消收藏歌单 -71. 歌单分类 -72. 收藏的歌手列表 -73. 订阅的电台列表 -74. 相关歌单推荐 -75. 付费精选接口 -76. 音乐是否可用检查接口 -77. 登录状态 -78. 获取视频播放地址 -79. 发送/删除评论 -80. 热门评论 -81. 视频评论 -82. 退出登录 -83. 所有榜单 -84. 所有榜单内容摘要 -85. 收藏视频 -86. 收藏 MV -87. 视频详情 -88. 相关视频 -89. 关注用户 -90. 新歌速递 -91. 喜欢音乐列表(无序) -92. 收藏的 MV 列表 -93. 获取最新专辑 -94. 听歌打卡 -95. 获取视频标签/分类下的视频 -96. 已收藏专辑列表 -97. 获取动态评论 -98. 歌单收藏者列表 -99. 云盘歌曲删除 -100. 热门话题 -101. 电台 - 推荐类型 -102. 电台 - 非热门类型 -103. 电台 - 今日优选 -104. 心动模式/智能播放 -105. 转发动态 -106. 删除动态 -107. 分享歌曲、歌单、mv、电台、电台节目到动态 -108. 通知-私信 -109. 通知-评论 -110. 通知-@我 -111. 通知-通知 -112. 设置 -113. 云盘数据详情 -114. 私信内容 -115. 我的数字专辑 -116. batch批量请求接口 -117. 获取视频标签列表 -118. 全部mv -119. 网易出品mv -120. 收藏/取消收藏专辑 -121. 专辑动态信息 -122. 热搜列表(详细) -123. 更换绑定手机 -124. 检测手机号码是否已注册 -125. 初始化昵称 -126. 更新歌单描述 -127. 更新歌单名 -128. 更新歌单标签 -129. 默认搜索关键词 -130. 删除歌单 -131. 电台banner -132. 用户电台 -133. 热门电台 -134. 电台 - 节目详情 -135. 电台 - 节目榜 -136. 电台 - 新晋电台榜/热门电台榜 -137. 类别热门电台 -138. 云村热评 -139. 电台24小时节目榜 -140. 电台24小时主播榜 -141. 电台最热主播榜 -142. 电台主播新人榜 -143. 电台付费精品榜 -144. 歌手热门50首歌曲 -145. 购买数字专辑 -146. 获取 mv 点赞转发评论数数据 -147. 获取视频点赞转发评论数数据 -148. 调整歌单顺序 -149. 调整歌曲顺序 -150. 独家放送列表 -151. 获取推荐视频 -152. 获取视频分类列表 -153. 获取全部视频列表接口 -154. 获取历史日推可用日期列表 -155. 获取历史日推详细数据 -156. 国家编码列表 -157. 首页-发现 -158. 首页-发现-圆形图标入口列表 -159. 数字专辑-全部新碟 -160. 数字专辑-热门新碟 -161. 数字专辑&数字单曲-榜单 -162. 数字专辑-语种风格馆 -163. 数字专辑详情 -164. 更新头像 -165. 歌单封面上传 -166. 楼层评论 -167. 歌手全部歌曲 -168. 精品歌单标签列表 -169. 用户等级信息 -170. 电台个性推荐 -171. 用户绑定信息 -172. 用户绑定手机 -173. 新版评论 -174. 点赞过的视频 -175. 收藏视频到视频歌单 -176. 删除视频歌单里的视频 -177. 最近播放的视频 -178. 音乐日历 -179. 电台订阅者列表 -180. 云贝签到信息 -181. 云贝签到 -182. 云贝所有任务 -183. 云贝todo任务 -184. 云贝今日签到信息 -185. 云贝完成任务 -186. 云贝收入 -187. 云贝支出 -188. 云贝账户信息 -189. 账号信息 -190. 最近联系人 -191. 私信音乐 -192. 抱一抱评论 -193. 评论抱一抱列表 -194. 收藏的专栏 -195. 关注歌手新歌 -196. 关注歌手新MV -197. 歌手详情 -198. 云盘上传 -199. 二维码登录 -200. 话题详情 -201. 话题详情热门动态 -202. 歌单详情动态 -203. 绑定手机 -204. 一起听状态 - -## 更新日志 - -[changelog](https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/CHANGELOG.MD) - -## 单元测试 - -```shell -$ npm test -``` - -![单元测试](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/screenshot1.png) -![单元测试](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/screenshot2.png) - -## 贡献者 -![](https://opencollective.com/NeteaseCloudMusicApi/contributors.svg?width=890) - - -## License - -[The MIT License (MIT)](https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/LICENSE) diff --git a/packages/api/app.js b/packages/api/app.js deleted file mode 100755 index 7601dd7c..00000000 --- a/packages/api/app.js +++ /dev/null @@ -1,106 +0,0 @@ -const fs = require('fs') -const path = require('path') -const express = require('express') -const bodyParser = require('body-parser') -const request = require('./util/request') -const cache = require('./util/apicache').middleware -const { cookieToJson } = require('./util/index') -const fileUpload = require('express-fileupload') - -const app = express() - -// CORS & Preflight request -app.use((req, res, next) => { - if (req.path !== '/' && !req.path.includes('.')) { - res.set({ - 'Access-Control-Allow-Credentials': true, - 'Access-Control-Allow-Origin': req.headers.origin || '*', - 'Access-Control-Allow-Headers': 'X-Requested-With,Content-Type', - 'Access-Control-Allow-Methods': 'PUT,POST,GET,DELETE,OPTIONS', - 'Content-Type': 'application/json; charset=utf-8', - }) - } - req.method === 'OPTIONS' ? res.status(204).end() : next() -}) - -// cookie parser -app.use((req, res, next) => { - req.cookies = {} - ;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => { - let crack = pair.indexOf('=') - if (crack < 1 || crack == pair.length - 1) return - req.cookies[ - decodeURIComponent(pair.slice(0, crack)).trim() - ] = decodeURIComponent(pair.slice(crack + 1)).trim() - }) - next() -}) - -// body parser -app.use(bodyParser.json()) -app.use(bodyParser.urlencoded({ extended: false })) - -app.use(fileUpload()) - -// static -app.use(express.static(path.join(__dirname, 'public'))) - -// cache -app.use(cache('2 minutes', (req, res) => res.statusCode === 200)) -// router -const special = { - 'daily_signin.js': '/daily_signin', - 'fm_trash.js': '/fm_trash', - 'personal_fm.js': '/personal_fm', -} - -fs.readdirSync(path.join(__dirname, 'module')) - .reverse() - .forEach((file) => { - if (!file.endsWith('.js')) return - let route = - file in special - ? special[file] - : '/' + file.replace(/\.js$/i, '').replace(/_/g, '/') - let question = require(path.join(__dirname, 'module', file)) - - app.use(route, (req, res) => { - ;[req.query, req.body].forEach((item) => { - if (typeof item.cookie === 'string') { - item.cookie = cookieToJson(decodeURIComponent(item.cookie)) - } - }) - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ) - - question(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)) - res.append('Set-Cookie', answer.cookie) - res.status(answer.status).send(answer.body) - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }) - if (answer.body.code == '301') answer.body.msg = '需要登录' - res.append('Set-Cookie', answer.cookie) - res.status(answer.status).send(answer.body) - }) - }) - }) - -const port = process.env.PORT || 32768 -const host = process.env.HOST || '' - -app.server = app.listen(port, host, () => { - console.log(`server running @ http://${host ? host : 'localhost'}:${port}`) -}) - -module.exports = app diff --git a/packages/api/app.test.js b/packages/api/app.test.js deleted file mode 100644 index e6ddbd0b..00000000 --- a/packages/api/app.test.js +++ /dev/null @@ -1,15 +0,0 @@ -const fs = require('fs') -const path = require('path') - -let app -before(() => { - app = require('./app.js') - global.host = 'http://localhost:' + app.server.address().port -}) -after(done => { - app.server.close(done) -}) - -fs.readdirSync(path.join(__dirname, 'test')).forEach(file => { - require(path.join(__dirname, 'test', file)) -}) diff --git a/packages/api/index.js b/packages/api/index.js deleted file mode 100644 index 39d0ba31..00000000 --- a/packages/api/index.js +++ /dev/null @@ -1 +0,0 @@ -require('./app.js') diff --git a/packages/api/interface.d.ts b/packages/api/interface.d.ts deleted file mode 100644 index 677be8bc..00000000 --- a/packages/api/interface.d.ts +++ /dev/null @@ -1,1411 +0,0 @@ -export interface RequestBaseConfig { - cookie?: string - realIP?: string // IPv4/IPv6 filled in X-Real-IP - proxy?: string // HTTP proxy -} - -export interface MultiPageConfig { - limit?: string | number - offset?: string | number -} - -export interface ImageUploadConfig { - imgFile: { - name: string - data: string | Buffer - } - imgSize?: number - imgX?: number - imgY?: number -} - -export interface APIBaseResponse { - code: number - cookie: string - [index: string]: unknown -} - -export interface Response { - status: number // The Http Response Code - body: APIBaseResponse // API Response body - cookie: string[] -} - -export const enum SubAction { - sub = 1, - unsub = 0, -} - -export function activate_init_profile( - params: { nickname: string } & RequestBaseConfig, -): Promise - -export function album( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function album_detail( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function album_detail_dynamic( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export const enum AlbumListArea { - all = 'ALL', - zh = 'ZH', - ea = 'EA', - kr = 'KR', - jp = 'JP', -} - -export const enum ListOrder { - hot = 'hot', - new = 'new', -} - -export function album_list( - params: { area?: AlbumListArea; type: string } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export const enum AlbumListStyleArea { - zh = 'Z_H', - ea = 'E_A', - kr = 'KR', - jp = 'JP', -} - -export function album_list_style( - params: { area?: AlbumListStyleArea } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function album_new( - params: { area?: AlbumListArea } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function album_newest(params: RequestBaseConfig): Promise - -export const enum AlbumSongsaleboardType { - daily = 'daily', - week = 'week', - year = 'year', - total = 'total', -} - -export const enum AlbumSongsaleboardAlbumType { - album = 0, - single = 1, -} - -export function album_songsaleboard( - params: { - albumType?: AlbumSongsaleboardAlbumType // 0 为数字专辑,1 为数字单曲 - type?: AlbumSongsaleboardType - year?: string | number // 年份,默认本年。 type 为 year 时有效 - } & RequestBaseConfig, -): Promise - -export function album_sub( - params: { - id: string | number - t: SubAction - } & RequestBaseConfig, -): Promise - -export function album_sublist( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function artist_album( - params: { id: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function artist_desc( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export const enum ArtistListArea { - zh = 'Z_H', - ea = 'E_A', - kr = 'KR', - jp = 'JP', -} - -export const enum ArtistArea { - all = '-1', - zh = '7', - ea = '96', - ja = '8', - kr = '16', - other = '0', -} - -export const enum ArtistType { - male = '1', - female = '2', - band = '3', -} - -export function artist_list( - params: { - area: ArtistArea - initial?: - | 'a' - | 'b' - | 'c' - | 'd' - | 'e' - | 'f' - | 'g' - | 'h' - | 'i' - | 'j' - | 'k' - | 'l' - | 'm' - | 'n' - | 'o' - | 'p' - | 'q' - | 'r' - | 's' - | 't' - | 'u' - | 'v' - | 'w' - | 'x' - | 'y' - | 'z' - | 'A' - | 'B' - | 'C' - | 'D' - | 'E' - | 'F' - | 'G' - | 'H' - | 'I' - | 'J' - | 'K' - | 'L' - | 'M' - | 'N' - | 'O' - | 'P' - | 'Q' - | 'R' - | 'S' - | 'T' - | 'U' - | 'V' - | 'W' - | 'X' - | 'Y' - | 'Z' - type?: ArtistType - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function artist_mv( - params: { id: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export const enum ArtistSongsOrder { - hot = 'hot', - time = 'time', -} - -export function artist_songs( - params: { - id: string | number - order?: ArtistSongsOrder - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function artist_sub( - params: { id: string | number; t: SubAction } & RequestBaseConfig, -): Promise - -export function artist_sublist( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function artist_top_song( - params: { - id: string | number - } & RequestBaseConfig, -): Promise - -export function artists( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function avatar_upload( - params: ImageUploadConfig & RequestBaseConfig, -): Promise - -export const enum BannerType { - pc = 0, - android = 1, - iphone = 2, - ipad = 3, -} - -export function banner( - params: { type?: BannerType } & RequestBaseConfig, -): Promise - -export function batch( - params: { [index: string]: unknown } & RequestBaseConfig, -): Promise - -export function captcha_sent( - params: { cellphone: string; ctcode?: number | string } & RequestBaseConfig, -): Promise - -export function captcha_verify( - params: { - ctcode?: number | string - cellphone: number | string - captcha: string - } & RequestBaseConfig, -): Promise - -export function cellphone_existence_check( - params: { - cellphone: number | string - countrycode: number | string - } & RequestBaseConfig, -): Promise - -export function check_music( - params: { id: string | number; br: string | number } & RequestBaseConfig, -): Promise - -export const enum SearchType { - single = 1, - album = 10, - artist = 100, - playlist = 1000, - user = 1002, - mv = 1004, - lyric = 1006, - dj = 1009, - video = 1014, - complex = 1018, -} - -export function cloudsearch( - params: { - keywords: string - type?: SearchType - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export const enum CommentType { - song = 0, - mv = 1, - playlist = 2, - album = 3, - dj = 4, - video = 5, - event = 6, -} - -export const enum CommentAction { - add = 1, - delete = 0, - reply = 2, -} - -export function comment( - params: { - id: string | number - type: CommentType - t: CommentAction.delete - commentId: string | number - } & RequestBaseConfig, -): Promise - -export function comment( - params: { - type: CommentType.event - t: CommentAction.delete - threadId: string - commentId: string | number - } & RequestBaseConfig, -): Promise - -export function comment( - params: { - id: string | number - type: CommentType - t: CommentAction.add - content: string | number - } & RequestBaseConfig, -): Promise - -export function comment( - params: { - type: CommentType.event - t: CommentAction.add - threadId: string - content: string | number - } & RequestBaseConfig, -): Promise - -export function comment( - params: { - id: string | number - type: CommentType - t: CommentAction.reply - content: string | number - commentId: string | number - } & RequestBaseConfig, -): Promise - -export function comment( - params: { - type: CommentType.event - t: CommentAction.reply - threadId: string - content: string | number - commentId: string | number - } & RequestBaseConfig, -): Promise - -export function comment_album( - params: { - id: string | number - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_dj( - params: { - id: string | number - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_event( - params: { - threadId: string - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_floor( - params: { - id: string | number - parentCommentId: string | number - type: CommentType - limit?: string | number - time?: string | number - } & RequestBaseConfig, -): Promise - -export function comment_hot( - params: { - id: string | number - type: CommentType - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_hotwall_list( - params: RequestBaseConfig, -): Promise - -export function comment_like( - params: { - id: string | number - type: CommentType - t: SubAction - cid: string | number - threadId?: string - } & RequestBaseConfig, -): Promise - -export function comment_music( - params: { - id: string | number - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_mv( - params: { - id: string | number - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_playlist( - params: { - id: string | number - - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function comment_video( - params: { - id: string | number - before?: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function countries_code_list( - params: RequestBaseConfig, -): Promise - -export const enum DailySigninType { - android = 0, - pc = 1, -} - -export function daily_signin( - params: { type?: DailySigninType } & RequestBaseConfig, -): Promise - -export function digitalAlbum_ordering( - params: { - payment: string - id: string | number - quantity: string - } & RequestBaseConfig, -): Promise - -export function digitalAlbum_purchased( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_banner(params: RequestBaseConfig): Promise - -export function dj_category_excludehot( - params: RequestBaseConfig, -): Promise - -export function dj_category_recommend( - params: RequestBaseConfig, -): Promise - -export function dj_catelist(params: RequestBaseConfig): Promise - -export function dj_detail( - params: { rid: string | number } & RequestBaseConfig, -): Promise - -export function dj_hot( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_paygift( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_personalize_recommend( - params: { limit?: string | number } & RequestBaseConfig, -): Promise - -export function dj_program( - params: { - rid: string | number - asc: 'true' | 1 | 'false' | 0 - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function dj_program_detail( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function dj_program_toplist( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_program_toplist_hours( - params: { limit?: string | number } & RequestBaseConfig, -): Promise - -export function dj_radio_hot( - params: { - cateId: string | number - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function dj_recommend(params: RequestBaseConfig): Promise - -/* - 有声书 10001 - 知识技能 453050 - 商业财经 453051 - 人文历史 11 - 外语世界 13 - 亲子宝贝 14 - 创作|翻唱 2001 - 音乐故事 2 - 3D|电子 10002 - 相声曲艺 8 - 情感调频 3 - 美文读物 6 - 脱口秀 5 - 广播剧 7 - 二次元 3001 - 明星做主播 1 - 娱乐|影视 4 - 科技科学 453052 - 校园|教育 4001 - 旅途|城市 12 -*/ - -export function dj_recommend_type( - params: { type: number } & RequestBaseConfig, -): Promise - -export function dj_sub( - params: { t: SubAction; rid: string | number } & RequestBaseConfig, -): Promise - -export function dj_sublist( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_today_perfered( - params: { page?: string | number } & RequestBaseConfig, -): Promise - -export function dj_toplist( - params: { type?: ListOrder } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_toplist_hours( - params: { limit?: string | number } & RequestBaseConfig, -): Promise - -export function dj_toplist_newcomer( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function dj_toplist_pay( - params: { limit?: string | number } & RequestBaseConfig, -): Promise - -export function dj_toplist_popular( - params: { limit?: string | number } & RequestBaseConfig, -): Promise - -export function event( - params: { pagesize?: number; lasttime?: number } & RequestBaseConfig, -): Promise - -export function event_del( - params: { evId: string | number } & RequestBaseConfig, -): Promise - -export function event_forward( - params: { - forwords: string - evId: string | number - uid: string | number - } & RequestBaseConfig, -): Promise - -export function fm_trash( - params: { id: string | number; time?: string | number } & RequestBaseConfig, -): Promise - -export function follow( - params: { t: SubAction; id: string | number } & RequestBaseConfig, -): Promise - -export function history_recommend_songs( - params: RequestBaseConfig, -): Promise - -export function history_recommend_songs_detail( - params: { date?: string } & RequestBaseConfig, -): Promise - -export function homepage_block_page( - params: { refresh?: 'true' | 'false' | boolean } & RequestBaseConfig, -): Promise - -export function homepage_dragon_ball( - params: RequestBaseConfig, -): Promise - -export function hot_topic( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function like( - params: { - like?: 'true' | 'false' | boolean - id: string | number - alg?: string - time?: string | number - } & RequestBaseConfig, -): Promise - -export function likelist( - params: { uid: string | number } & RequestBaseConfig, -): Promise - -export function login( - params: { email: string; password: string } & RequestBaseConfig, -): Promise - -export function login( - params: { email: string; md5_password: string } & RequestBaseConfig, -): Promise - -export function login_cellphone( - params: { - phone: number | string - countrycode?: number | string - password: string - } & RequestBaseConfig, -): Promise - -export function login_cellphone( - params: { - phone: number | string - countrycode?: number | string - md5_password: string - } & RequestBaseConfig, -): Promise - -export function login_refresh(params: RequestBaseConfig): Promise - -export function login_status(params: RequestBaseConfig): Promise - -export function logout(params: RequestBaseConfig): Promise - -export function lyric( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function msg_comments( - params: { - uid: string | number - before?: string | number - limit?: string | number - } & RequestBaseConfig, -): Promise - -export function msg_forwards( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function msg_notices( - params: { - limit?: string | number - lasttime?: string | number - } & RequestBaseConfig, -): Promise - -export function msg_private( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function msg_private_history( - params: { - before?: string | number - limit?: string | number - uid: string | number - } & RequestBaseConfig, -): Promise - -export const enum MvArea { - all = '全部', - zh = '内地', - hk = '港台', - ea = '欧美', - kr = '韩国', - jp = '日本', -} - -export const enum MvType { - all = '全部', - offical = '官方版', - raw = '原生', - live = '现场版', - netease = '网易出品', -} - -export const enum MvOrder { - trend = '上升最快', - hot = '最热', - new = '最新', -} - -export function mv_all( - params: { - area?: MvArea - type?: MvType - order?: MvOrder - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function mv_detail( - params: { mvid?: string | number } & RequestBaseConfig, -): Promise - -export function mv_detail_info( - params: { mvid: string | number } & RequestBaseConfig, -): Promise - -export function mv_exclusive_rcmd( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function mv_first( - params: { area?: MvArea; limit?: string | number } & RequestBaseConfig, -): Promise - -export function mv_sub( - params: { t: SubAction; mvid: string | number } & RequestBaseConfig, -): Promise - -export function mv_sublist( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function mv_url( - params: { id?: string | number; r?: string | number } & RequestBaseConfig, -): Promise - -export function personal_fm(params: RequestBaseConfig): Promise - -export function personalized( - params: { limit?: string | number } & RequestBaseConfig, -): Promise - -export function personalized_djprogram( - params: RequestBaseConfig, -): Promise - -export function personalized_mv(params: RequestBaseConfig): Promise - -export function personalized_newsong( - params: { - area?: string | number - limit?: string | number - } & RequestBaseConfig, -): Promise - -export function personalized_privatecontent( - params: RequestBaseConfig, -): Promise - -export function personalized_privatecontent_list( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function playlist_catlist(params: RequestBaseConfig): Promise - -export function playlist_cover_update( - params: { id: string } & ImageUploadConfig & RequestBaseConfig, -): Promise - -export function playlist_create( - params: { - name: string - privacy: 0 | 10 - type?: PlaylistType - } & RequestBaseConfig, -): Promise - -export function playlist_delete( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function playlist_desc_update( - params: { id: string | number; desc: string } & RequestBaseConfig, -): Promise - -export function playlist_detail( - params: { id: string | number; s?: string | number } & RequestBaseConfig, -): Promise - -export function playlist_highquality_tags( - params: RequestBaseConfig, -): Promise - -export function playlist_hot(params: RequestBaseConfig): Promise - -export function playlist_name_update( - params: { id: string | number; name: string } & RequestBaseConfig, -): Promise - -export function playlist_order_update( - params: { ids: string } & RequestBaseConfig, -): Promise - -export function playlist_subscribe( - params: { t: SubAction; id: string | number } & RequestBaseConfig, -): Promise - -export function playlist_subscribers( - params: { id?: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function playlist_tags_update( - params: { id: string | number; tags: string } & RequestBaseConfig, -): Promise - -export function playlist_tracks( - params: { - op: 'add' | 'del' - pid: string | number - tracks: string - } & RequestBaseConfig, -): Promise - -export function playlist_update( - params: { - id: string | number - name: string - desc?: string - tags?: string - } & RequestBaseConfig, -): Promise - -export function playmode_intelligence_list( - params: { - id: string | number - pid: string | number - sid?: string | number - count?: string | number - } & RequestBaseConfig, -): Promise - -export function program_recommend( - params: { type: string } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function rebind( - params: { - captcha: string - phone: string - oldcaptcha: string - ctcode?: number | string - } & RequestBaseConfig, -): Promise - -export function recommend_resource(params: RequestBaseConfig): Promise - -export function recommend_songs(params: RequestBaseConfig): Promise - -export function register_cellphone( - params: { - captcha: string - phone: string - password: string - nickname: string - } & RequestBaseConfig, -): Promise - -export function related_allvideo( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function related_playlist( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export const enum ResourceType { - mv = 1, - dj = 4, - video = 5, - event = 6, -} -type PlaylistType = 'NROMAL' | 'VIDEO' - -export function resource_like( - params: { - t: SubAction - type: ResourceType - id?: string | number - threadId?: string - } & RequestBaseConfig, -): Promise - -export function scrobble( - params: { - id: string | number - sourceid: string | number - time: string | number - } & RequestBaseConfig, -): Promise - -export function search( - params: { - keywords: string - type?: SearchType - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function search_default(params: RequestBaseConfig): Promise - -export function search_hot(params: RequestBaseConfig): Promise - -export function search_hot_detail(params: RequestBaseConfig): Promise - -export function search_multimatch( - params: { type?: number; keywords: string } & RequestBaseConfig, -): Promise - -export const enum SearchSuggestType { - mobile = 'mobile', - web = 'web', -} - -export function search_suggest( - params: { keywords: string; type?: SearchSuggestType } & RequestBaseConfig, -): Promise - -export function send_playlist( - params: { - playlist: string | number - msg: string - user_ids: string - } & RequestBaseConfig, -): Promise - -export function send_text( - params: { msg: string; user_ids: string } & RequestBaseConfig, -): Promise - -export function setting(params: RequestBaseConfig): Promise - -export const enum ShareResourceType { - song = 'song', - playlist = 'playlist', - mv = 'mv', - djprogram = 'djprogram', - djradio = 'djradio', -} - -export function share_resource( - params: { - type?: ShareResourceType - msg?: string - id?: string | number - } & RequestBaseConfig, -): Promise - -export function simi_artist( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function simi_mv( - params: { mvid: string | number } & RequestBaseConfig, -): Promise - -export function simi_playlist( - params: { id: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function simi_song( - params: { id: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function simi_user( - params: { id: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function song_detail( - params: { ids: string } & RequestBaseConfig, -): Promise - -export function song_order_update( - params: { pid: string | number; ids: string } & RequestBaseConfig, -): Promise - -export function song_url( - params: { id: string | number; br?: string | number } & RequestBaseConfig, -): Promise - -export function top_album( - params: { - area?: AlbumListArea - type?: ListOrder - year?: string - mouth?: string - } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function top_artists( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function top_list( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function top_mv( - params: { area?: MvArea } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function top_playlist( - params: { cat?: string; order?: ListOrder } & MultiPageConfig & - RequestBaseConfig, -): Promise - -export function top_playlist_highquality( - params: { - cat?: string - before?: string | number - limit?: string | number - } & RequestBaseConfig, -): Promise - -export const enum TopSongType { - all = 0, - zh = 7, - ea = 96, - kr = 16, - ja = 8, -} - -export function top_song( - params: { type: TopSongType } & RequestBaseConfig, -): Promise - -export function toplist(params: RequestBaseConfig): Promise - -export const enum ToplistArtistType { - zh = 1, - ea = 2, - kr = 3, - ja = 4, -} - -export function toplist_artist( - params: { type?: ToplistArtistType } & RequestBaseConfig, -): Promise - -export function toplist_detail(params: RequestBaseConfig): Promise - -export function user_audio( - params: { uid: string | number } & RequestBaseConfig, -): Promise - -export function user_cloud( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function user_cloud_del( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function user_cloud_detail( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function user_detail( - params: { uid: string | number } & RequestBaseConfig, -): Promise - -export function user_dj( - params: { uid: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function user_event( - params: { - lasttime?: string | number - limit?: string | number - uid: string | number - } & RequestBaseConfig, -): Promise - -export function user_followeds( - params: { - uid: string | number - lasttime?: string | number - limit?: string | number - } & RequestBaseConfig, -): Promise - -export function user_follows( - params: { uid: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export function user_level(params: RequestBaseConfig): Promise - -export function user_playlist( - params: { uid: string | number } & MultiPageConfig & RequestBaseConfig, -): Promise - -export const enum UserRecordType { - all = 0, - weekly = 1, -} - -export function user_record( - params: { uid: string | number; type?: UserRecordType } & RequestBaseConfig, -): Promise - -export function user_subcount(params: RequestBaseConfig): Promise - -export function user_update( - params: { - birthday: string - city: string - gender: string - nickname: string - province: string - signature: string - } & RequestBaseConfig, -): Promise - -export function video_category_list( - params: MultiPageConfig & RequestBaseConfig, -): Promise - -export function video_detail( - params: { id: string } & RequestBaseConfig, -): Promise - -export function video_detail_info( - params: { vid: string } & RequestBaseConfig, -): Promise - -export function video_group( - params: { id: string; offset?: string | number } & RequestBaseConfig, -): Promise - -export function video_group_list(params: RequestBaseConfig): Promise - -export function video_sub( - params: { t?: SubAction; id: string } & RequestBaseConfig, -): Promise - -export function video_timeline_all( - params: { offset?: string | number } & RequestBaseConfig, -): Promise - -export function video_timeline_recommend( - params: { offset?: string | number } & RequestBaseConfig, -): Promise - -export function video_url( - params: { id: string | number; res?: number } & RequestBaseConfig, -): Promise - -export function weblog( - params: { data?: { [index: string]: unknown } } & RequestBaseConfig, -): Promise - -export function playlist_mylike( - params: { - time?: number | string - limit: number | string - } & RequestBaseConfig, -): Promise - -export function playlist_track_add( - params: { pid?: number | string; ids: number | string } & RequestBaseConfig, -): Promise - -export function playlist_track_delete( - params: { pid?: number | string; ids: number | string } & RequestBaseConfig, -): Promise - -export function comment_new( - params: { - type?: number | string - id: number | string - pageNo?: number | string - pageSize?: number | string - sortType?: number | string - } & RequestBaseConfig, -): Promise - -export function calendar( - params: { - startTime?: number | string - endTime: number | string - } & RequestBaseConfig, -): Promise - -export function playlist_video_recent( - params: RequestBaseConfig, -): Promise - -export function user_binding( - params: { uid?: number | string } & RequestBaseConfig, -): Promise - -export function user_replacephone( - params: { - phone: number | string - captcha: number | string - oldcaptcha: number | string - countrycode?: number | string - } & RequestBaseConfig, -): Promise - -export function user_safe(params: RequestBaseConfig): Promise - -export function dj_subscriber( - params: { - id: number | string - limit?: number | string - time?: number | string - } & RequestBaseConfig, -): Promise - -export function user_account(params: RequestBaseConfig): Promise - -export function yunbei(params: RequestBaseConfig): Promise - -export function yunbei_info(params: RequestBaseConfig): Promise - -export function yunbei_sign(params: RequestBaseConfig): Promise - -export function yunbei_receipt( - params: { - limit?: number | string - offset?: number | string - } & RequestBaseConfig, -): Promise - -export function yunbei_expense( - params: { - limit?: number | string - offset?: number | string - } & RequestBaseConfig, -): Promise - -export function yunbei_tasks(params: RequestBaseConfig): Promise - -export function yunbei_today(params: RequestBaseConfig): Promise - -export function yunbei_tasks_todo(params: RequestBaseConfig): Promise - -export function yunbei_task_finish( - params: { - userTaskId: number | string - depositCode?: number | string - } & RequestBaseConfig, -): Promise - -export function msg_recentcontact(params: RequestBaseConfig): Promise - -export function hug_comment( - params: { - uid: number | string - cid: number | string - sid: number | string - } & RequestBaseConfig, -): Promise - -export function comment_hug_list( - params: { - page: number | string - cursor: number | string - idCursor: number | string - pageSize?: number | string - } & RequestBaseConfig, -): Promise - -export function topic_sublist( - params: { - limit?: number | string - offset?: number | string - } & RequestBaseConfig, -): Promise - -export function topic_sublist( - params: { - limit?: number | string - offset?: number | string - } & RequestBaseConfig, -): Promise - -export function artist_new_mv( - params: { - limit?: number | string - startTimestamp?: number | string - } & RequestBaseConfig, -): Promise - -export function artist_new_song( - params: { - limit?: number | string - startTimestamp?: number | string - } & RequestBaseConfig, -): Promise - -export function artist_detail( - params: { - id: number | string - } & RequestBaseConfig, -): Promise - -export function cloud(params: RequestBaseConfig): Promise - -export function topic_detail( - params: { - actid?: number | string - } & RequestBaseConfig, -): Promise - -export function topic_detail_event_hot( - params: { - actid?: number | string - } & RequestBaseConfig, -): Promise - -export function login_qr_key(params: RequestBaseConfig): Promise - -export function login_qr_create( - params: { - key?: number | string - qrimg?: boolean | string - } & RequestBaseConfig, -): Promise - -export function login_qr_check( - params: { - key?: number | string - } & RequestBaseConfig, -): Promise - -export function playlist_detail_dynamic( - params: { id: string | number } & RequestBaseConfig, -): Promise - -export function user_bindingcellphone( - params: { - phone: number | string - captcha: number | string - countrycode?: number | string - password?: string - } & RequestBaseConfig, -): Promise - -export function listen_together_status( - params: RequestBaseConfig, -): Promise diff --git a/packages/api/issue_template.md b/packages/api/issue_template.md deleted file mode 100644 index 3b7bcb8d..00000000 --- a/packages/api/issue_template.md +++ /dev/null @@ -1,29 +0,0 @@ -## 环境 -- 系统/平台: <你的系统和平台> - -- nodejs 版本: <你的 NodeJS 版本号> - -- API版本:<运行的云音乐 API 的版本号, 对应 package.json 里面的 version> - -## 出现问题 -<出现的问题> - -## 重现步骤 -<重现步骤> - -## 期待效果 -<现在的效果,期待的效果> - - - ->先看文档有没有相关说明,调用前须知必看 - ->先在 issues 搜一下是否有相似问题,没有再发,否则直接关闭 - ->不处理别人搭建的线上服务的问题,此项目不提供任何线上服务,请自行搭建 - ->重现步骤尽量详细,不能含糊不清,包含请求地址和对应参数以及操作过程描述,不是每个人都喜欢猜别人遇到了什么问题和找参数一个个试,也比较浪费时间 - ->如果不是提建议,提 issues 如果不照着模版来将不会优先处理或直接关闭 - ->460 cheating 的问题把 `utils/request.js` 里面的 `headers['X-Real-IP']` 的注释取消掉就好 diff --git a/packages/api/main.js b/packages/api/main.js deleted file mode 100644 index 02dd6e2b..00000000 --- a/packages/api/main.js +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs') -const path = require('path') -const request = require('./util/request') -const { cookieToJson } = require('./util/index') - -let obj = {} -fs.readdirSync(path.join(__dirname, 'module')) - .reverse() - .forEach(file => { - if (!file.endsWith('.js')) return - let fileModule = require(path.join(__dirname, 'module', file)) - obj[file.split('.').shift()] = function(data) { - if (typeof data.cookie === 'string') { - data.cookie = cookieToJson(data.cookie) - } - return fileModule( - { - ...data, - cookie: data.cookie ? data.cookie : {}, - }, - request, - ) - } - }) - -module.exports = obj diff --git a/packages/api/module/activate_init_profile.js b/packages/api/module/activate_init_profile.js deleted file mode 100644 index 0fe48ba1..00000000 --- a/packages/api/module/activate_init_profile.js +++ /dev/null @@ -1,19 +0,0 @@ -// 初始化名字 - -module.exports = (query, request) => { - const data = { - nickname: query.nickname, - } - return request( - 'POST', - `https://music.163.com/eapi/activate/initProfile`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/activate/initProfile', - }, - ) -} diff --git a/packages/api/module/album.js b/packages/api/module/album.js deleted file mode 100644 index bc5e0869..00000000 --- a/packages/api/module/album.js +++ /dev/null @@ -1,15 +0,0 @@ -// 专辑内容 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/album/${query.id}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_detail.js b/packages/api/module/album_detail.js deleted file mode 100644 index a26fef35..00000000 --- a/packages/api/module/album_detail.js +++ /dev/null @@ -1,17 +0,0 @@ -// 数字专辑详情 -module.exports = (query, request) => { - const data = { - id: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/vipmall/albumproduct/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_detail_dynamic.js b/packages/api/module/album_detail_dynamic.js deleted file mode 100644 index 3d08e64f..00000000 --- a/packages/api/module/album_detail_dynamic.js +++ /dev/null @@ -1,17 +0,0 @@ -// 专辑动态信息 -module.exports = (query, request) => { - const data = { - id: query.id, - } - return request( - 'POST', - `https://music.163.com/api/album/detail/dynamic`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_list.js b/packages/api/module/album_list.js deleted file mode 100644 index fe70dd87..00000000 --- a/packages/api/module/album_list.js +++ /dev/null @@ -1,21 +0,0 @@ -// 数字专辑-新碟上架 -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - area: query.area || 'ALL', //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本 - type: query.type, - } - return request( - 'POST', - `https://music.163.com/weapi/vipmall/albumproduct/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_list_style.js b/packages/api/module/album_list_style.js deleted file mode 100644 index 8b92a7a9..00000000 --- a/packages/api/module/album_list_style.js +++ /dev/null @@ -1,20 +0,0 @@ -// 数字专辑-语种风格馆 -module.exports = (query, request) => { - const data = { - limit: query.limit || 10, - offset: query.offset || 0, - total: true, - area: query.area || 'Z_H', //Z_H:华语,E_A:欧美,KR:韩国,JP:日本 - } - return request( - 'POST', - `https://music.163.com/weapi/vipmall/appalbum/album/style`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_new.js b/packages/api/module/album_new.js deleted file mode 100644 index b4652d3e..00000000 --- a/packages/api/module/album_new.js +++ /dev/null @@ -1,15 +0,0 @@ -// 全部新碟 -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - area: query.area || 'ALL', //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本 - } - return request('POST', `https://music.163.com/weapi/album/new`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/album_newest.js b/packages/api/module/album_newest.js deleted file mode 100644 index fe1f6506..00000000 --- a/packages/api/module/album_newest.js +++ /dev/null @@ -1,15 +0,0 @@ -// 最新专辑 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/discovery/newAlbum`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_songsaleboard.js b/packages/api/module/album_songsaleboard.js deleted file mode 100644 index a7974188..00000000 --- a/packages/api/module/album_songsaleboard.js +++ /dev/null @@ -1,24 +0,0 @@ -// 数字专辑&数字单曲-榜单 -module.exports = (query, request) => { - let data = { - albumType: query.albumType || 0, //0为数字专辑,1为数字单曲 - } - const type = query.type || 'daily' // daily,week,year,total - if (type === 'year') { - data = { - ...data, - year: query.year, - } - } - return request( - 'POST', - `https://music.163.com/api/feealbum/songsaleboard/${type}/type`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/album_sub.js b/packages/api/module/album_sub.js deleted file mode 100644 index 65c6b245..00000000 --- a/packages/api/module/album_sub.js +++ /dev/null @@ -1,14 +0,0 @@ -// 收藏/取消收藏专辑 - -module.exports = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub' - const data = { - id: query.id, - } - return request('POST', `https://music.163.com/api/album/${query.t}`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/album_sublist.js b/packages/api/module/album_sublist.js deleted file mode 100644 index 5d01578a..00000000 --- a/packages/api/module/album_sublist.js +++ /dev/null @@ -1,15 +0,0 @@ -// 已收藏专辑列表 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 25, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/weapi/album/sublist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/artist_album.js b/packages/api/module/artist_album.js deleted file mode 100644 index 92a04a78..00000000 --- a/packages/api/module/artist_album.js +++ /dev/null @@ -1,20 +0,0 @@ -// 歌手专辑列表 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - } - return request( - 'POST', - `https://music.163.com/weapi/artist/albums/${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/artist_desc.js b/packages/api/module/artist_desc.js deleted file mode 100644 index c67d7075..00000000 --- a/packages/api/module/artist_desc.js +++ /dev/null @@ -1,18 +0,0 @@ -// 歌手介绍 - -module.exports = (query, request) => { - const data = { - id: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/artist/introduction`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/artist_detail.js b/packages/api/module/artist_detail.js deleted file mode 100644 index 8bbb9d97..00000000 --- a/packages/api/module/artist_detail.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/artist/head/info/get`, - { - id: query.id, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/artist_list.js b/packages/api/module/artist_list.js deleted file mode 100644 index fe95864e..00000000 --- a/packages/api/module/artist_list.js +++ /dev/null @@ -1,37 +0,0 @@ -// 歌手分类 - -/* - type 取值 - 1:男歌手 - 2:女歌手 - 3:乐队 - - area 取值 - -1:全部 - 7华语 - 96欧美 - 8:日本 - 16韩国 - 0:其他 - - initial 取值 a-z/A-Z -*/ - -module.exports = (query, request) => { - const data = { - initial: isNaN(query.initial) - ? (query.initial || '').toUpperCase().charCodeAt() || undefined - : query.initial, - offset: query.offset || 0, - limit: query.limit || 30, - total: true, - type: query.type || '1', - area: query.area, - } - return request('POST', `https://music.163.com/api/v1/artist/list`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/artist_mv.js b/packages/api/module/artist_mv.js deleted file mode 100644 index 8decc043..00000000 --- a/packages/api/module/artist_mv.js +++ /dev/null @@ -1,16 +0,0 @@ -// 歌手相关MV - -module.exports = (query, request) => { - const data = { - artistId: query.id, - limit: query.limit, - offset: query.offset, - total: true, - } - return request('POST', `https://music.163.com/weapi/artist/mvs`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/artist_new_mv.js b/packages/api/module/artist_new_mv.js deleted file mode 100644 index 6c65343e..00000000 --- a/packages/api/module/artist_new_mv.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - const data = { - limit: query.limit || 20, - startTimestamp: query.before || Date.now(), - } - return request( - 'POST', - `https://music.163.com/api/sub/artist/new/works/mv/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/artist_new_song.js b/packages/api/module/artist_new_song.js deleted file mode 100644 index a367f8c4..00000000 --- a/packages/api/module/artist_new_song.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - const data = { - limit: query.limit || 20, - startTimestamp: query.before || Date.now(), - } - return request( - 'POST', - `https://music.163.com/api/sub/artist/new/works/song/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/artist_songs.js b/packages/api/module/artist_songs.js deleted file mode 100644 index 533e1e5e..00000000 --- a/packages/api/module/artist_songs.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - id: query.id, - private_cloud: 'true', - work_type: 1, - order: query.order || 'hot', //hot,time - offset: query.offset || 0, - limit: query.limit || 100, - } - return request('POST', `https://music.163.com/api/v1/artist/songs`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/artist_sub.js b/packages/api/module/artist_sub.js deleted file mode 100644 index ff46b043..00000000 --- a/packages/api/module/artist_sub.js +++ /dev/null @@ -1,20 +0,0 @@ -// 收藏与取消收藏歌手 - -module.exports = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub' - const data = { - artistId: query.id, - artistIds: '[' + query.id + ']', - } - return request( - 'POST', - `https://music.163.com/weapi/artist/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/artist_sublist.js b/packages/api/module/artist_sublist.js deleted file mode 100644 index c4adf408..00000000 --- a/packages/api/module/artist_sublist.js +++ /dev/null @@ -1,15 +0,0 @@ -// 关注歌手列表 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 25, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/weapi/artist/sublist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/artist_top_song.js b/packages/api/module/artist_top_song.js deleted file mode 100644 index c86136e6..00000000 --- a/packages/api/module/artist_top_song.js +++ /dev/null @@ -1,12 +0,0 @@ -// 歌手热门 50 首歌曲 -module.exports = (query, request) => { - const data = { - id: query.id, - } - return request('POST', `https://music.163.com/api/artist/top/song`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/artists.js b/packages/api/module/artists.js deleted file mode 100644 index 3f29e7f4..00000000 --- a/packages/api/module/artists.js +++ /dev/null @@ -1,15 +0,0 @@ -// 歌手单曲 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/artist/${query.id}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/audio_match.js b/packages/api/module/audio_match.js deleted file mode 100644 index a9a2cfaa..00000000 --- a/packages/api/module/audio_match.js +++ /dev/null @@ -1,19 +0,0 @@ -const realData = - 'eJx10mtIU2EcBvDtnCwNMfO2klUSmSQ5ZugKW/v/0TIjJVdhDStbXpqXrhY5Kwhtrcwiut9VSqMUMxX6IFqsD92sD1YgWGHRBcowKrpnPa/v+drg4flt572ds2PQ6XQut7MwJ940w2TOyS0pzF+/BV/MJrNO+3TVLOHUzKx5iw3/H5uZ7yxegct3tTl7Cr6QEa0gZ/dZOFsvfe5YHe1D+yFZxpncqEj/cCdwoirdVxHNnZrX3xygU5g7Eh6I9uOx8Ch4y9FQjlKkDz1pYrFXIJLUOovFGcYivqJgXqaXDqu7Rzc0XzmZxG81B/fF8wRVusn2jN5rDnwca8tFhyAJP4L4qiI9vX8cWzEmVKzT/46qxNpIdZOZz2HNcHhSkZ3D4AjYFpfGFkX6+dB+FvcSBe/SWbkLPVnEOJ1DFelXxVVci/Wj4TsBLhrQ/LGoaU4HxsTA28L76Cc8Dfau/U6F6FgkyBDDJar0g8tesmOvOHioWeXXmme6l3MLbIIre6wciU5E2t/k8WVxHfHvuUWXsH4SPCv1NW1Cz0aivgYO34vw1AEvi3MlIw0xHl6JNVPEGW41UJsqPaXYYTuEnotMdHwYfv7CFR/i+aXmrY5wrlSkEwr+0EJ0GvLmdw4/RS9Amj93UAbGZMIF40ezE3PtcG/yBWrT3L6oh66hFyMXK4xsUKT7aufzapxnFTwiNc3Wis5Bdm+OYCvmOuHj/ZeoQPOI00PUrUjXpG+kMFU61tFFDvQaZOn5DH4mzoLw4Hsaj14rzu/K4jF66fSWTnJinW3wBvcveqjZN3iFjKp0qKuF1mi21keST3NtTcbwu1eG3Dussr9eemljLIco0tVH7HwA493wOr+FlIjfy+GvkR4uwfjt4v/6G8K3NX8K38lt6B1ISa+Bv2O8Fy69foZOovci2S4Lr1aku4P9OEWVTt9wgMQ7exgJ8JXyI0W694WFyuBjcH75XyrEXsfhg+ZSvqZIf/Lct8Wp0md2tJN4PifEfjcm8gu02Ptbj459eum8eg8bFWlLXTb/A+uo9bM=' -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - algorithmCode: 'shazam_v2', - times: 1, - sessionId: 'C999431ACDC84EDBB984763654E6F8D7', - duration: 3.3066249999999995, - from: 'recognize-song', - rawdata: realData, - } - return request('POST', `https://music.163.com/api/music/audio/match`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/avatar_upload.js b/packages/api/module/avatar_upload.js deleted file mode 100644 index 94f018bc..00000000 --- a/packages/api/module/avatar_upload.js +++ /dev/null @@ -1,27 +0,0 @@ -const uploadPlugin = require('../plugins/upload') -module.exports = async (query, request) => { - const uploadInfo = await uploadPlugin(query, request) - const res = await request( - 'POST', - `https://music.163.com/weapi/user/avatar/upload/v1`, - { - imgid: uploadInfo.imgId, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - return { - status: 200, - body: { - code: 200, - data: { - ...uploadInfo, - ...res.body, - }, - }, - } -} diff --git a/packages/api/module/banner.js b/packages/api/module/banner.js deleted file mode 100644 index 00f52c9f..00000000 --- a/packages/api/module/banner.js +++ /dev/null @@ -1,17 +0,0 @@ -// 首页轮播图 - -module.exports = (query, request) => { - const type = - { - 0: 'pc', - 1: 'android', - 2: 'iphone', - 3: 'ipad', - }[query.type || 0] || 'pc' - return request( - 'POST', - `https://music.163.com/api/v2/banner/get`, - { clientType: type }, - { crypto: 'api', proxy: query.proxy, realIP: query.realIP }, - ) -} diff --git a/packages/api/module/batch.js b/packages/api/module/batch.js deleted file mode 100644 index 2e950700..00000000 --- a/packages/api/module/batch.js +++ /dev/null @@ -1,19 +0,0 @@ -// 批量请求接口 - -module.exports = (query, request) => { - const data = { - e_r: true, - } - Object.keys(query).forEach((i) => { - if (/^\/api\//.test(i)) { - data[i] = query[i] - } - }) - return request('POST', `https://music.163.com/eapi/batch`, data, { - crypto: 'eapi', - proxy: query.proxy, - url: '/api/batch', - cookie: query.cookie, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/calendar.js b/packages/api/module/calendar.js deleted file mode 100644 index 61bc387b..00000000 --- a/packages/api/module/calendar.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = (query, request) => { - const data = { - startTime: query.startTime || Date.now(), - endTime: query.endTime || Date.now(), - } - return request('POST', `https://music.163.com/api/mcalendar/detail`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/captcha_sent.js b/packages/api/module/captcha_sent.js deleted file mode 100644 index 076dcbb3..00000000 --- a/packages/api/module/captcha_sent.js +++ /dev/null @@ -1,14 +0,0 @@ -// 发送验证码 - -module.exports = (query, request) => { - const data = { - ctcode: query.ctcode || '86', - cellphone: query.phone, - } - return request('POST', `https://music.163.com/api/sms/captcha/sent`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/captcha_verify.js b/packages/api/module/captcha_verify.js deleted file mode 100644 index 990ce27f..00000000 --- a/packages/api/module/captcha_verify.js +++ /dev/null @@ -1,20 +0,0 @@ -// 校验验证码 - -module.exports = (query, request) => { - const data = { - ctcode: query.ctcode || '86', - cellphone: query.phone, - captcha: query.captcha, - } - return request( - 'POST', - `https://music.163.com/weapi/sms/captcha/verify`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/cellphone_existence_check.js b/packages/api/module/cellphone_existence_check.js deleted file mode 100644 index c4912ae1..00000000 --- a/packages/api/module/cellphone_existence_check.js +++ /dev/null @@ -1,20 +0,0 @@ -// 检测手机号码是否已注册 - -module.exports = (query, request) => { - const data = { - cellphone: query.phone, - countrycode: query.countrycode, - } - return request( - 'POST', - `https://music.163.com/eapi/cellphone/existence/check`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/cellphone/existence/check', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/check_music.js b/packages/api/module/check_music.js deleted file mode 100644 index 0e32ef9d..00000000 --- a/packages/api/module/check_music.js +++ /dev/null @@ -1,34 +0,0 @@ -// 歌曲可用性 - -module.exports = (query, request) => { - const data = { - ids: '[' + parseInt(query.id) + ']', - br: parseInt(query.br || 999000), - } - return request( - 'POST', - `https://music.163.com/weapi/song/enhance/player/url`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ).then((response) => { - let playable = false - if (response.body.code == 200) { - if (response.body.data[0].code == 200) { - playable = true - } - } - if (playable) { - response.body = { success: true, message: 'ok' } - return response - } else { - response.status = 404 - response.body = { success: false, message: '亲爱的,暂无版权' } - return Promise.reject(response) - } - }) -} diff --git a/packages/api/module/cloud.js b/packages/api/module/cloud.js deleted file mode 100644 index b7cdac33..00000000 --- a/packages/api/module/cloud.js +++ /dev/null @@ -1,147 +0,0 @@ -const mm = require('music-metadata') -const uploadPlugin = require('../plugins/songUpload') -const md5 = require('md5') -module.exports = async (query, request) => { - query.cookie.os = 'pc' - query.cookie.appver = '2.7.1.198277' - const bitrate = 999000 - if (!query.songFile) { - return Promise.reject({ - status: 500, - body: { - msg: '请上传音乐文件', - code: 500, - }, - }) - } - if (!query.songFile.md5) { - // 命令行上传没有md5和size信息,需要填充 - query.songFile.md5 = md5(query.songFile.data) - query.songFile.size = query.songFile.data.byteLength - } - const res = await request( - 'POST', - `https://interface.music.163.com/api/cloud/upload/check`, - { - bitrate: String(bitrate), - ext: '', - length: query.songFile.size, - md5: query.songFile.md5, - songId: '0', - version: 1, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - let artist = '' - let album = '' - let songName = '' - try { - const metadata = await mm.parseBuffer(query.songFile.data, 'audio/mpeg') - const info = metadata.common - if (info.title) { - songName = info.title - } - if (info.album) { - album = info.album - } - if (info.artist) { - artist = info.artist - } - // if (metadata.native.ID3v1) { - // metadata.native.ID3v1.forEach((item) => { - // // console.log(item.id, item.value) - // if (item.id === 'title') { - // songName = item.value - // } - // if (item.id === 'artist') { - // artist = item.value - // } - // if (item.id === 'album') { - // album = item.value - // } - // }) - // // console.log({ - // // songName, - // // album, - // // songName, - // // }) - // } - // console.log({ - // songName, - // album, - // songName, - // }) - } catch (error) { - console.log(error) - } - const tokenRes = await request( - 'POST', - `https://music.163.com/weapi/nos/token/alloc`, - { - bucket: '', - ext: 'mp3', - filename: query.songFile.name.replace('.mp3', ''), - local: false, - nos_product: 3, - type: 'audio', - md5: query.songFile.md5, - }, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy }, - ) - - if (res.body.needUpload) { - const uploadInfo = await uploadPlugin(query, request) - // console.log('uploadInfo', uploadInfo.body.result.resourceId) - } - // console.log(tokenRes.body.result) - const res2 = await request( - 'POST', - `https://music.163.com/api/upload/cloud/info/v2`, - { - md5: query.songFile.md5, - songid: res.body.songId, - filename: query.songFile.name, - song: songName || query.songFile.name.replace('.mp3', ''), - album: album || '未知专辑', - artist: artist || '未知艺术家', - bitrate: String(bitrate), - resourceId: tokenRes.body.result.resourceId, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - // console.log({ res2, privateCloud: res2.body.privateCloud }) - // console.log(res.body.songId, 'songid') - const res3 = await request( - 'POST', - `https://interface.music.163.com/api/cloud/pub/v2`, - { - songid: res2.body.songId, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - // console.log({ res3 }) - return { - status: 200, - body: { - ...res.body, - ...res3.body, - // ...uploadInfo, - }, - cookie: res.cookie, - } -} diff --git a/packages/api/module/cloudsearch.js b/packages/api/module/cloudsearch.js deleted file mode 100644 index e768e854..00000000 --- a/packages/api/module/cloudsearch.js +++ /dev/null @@ -1,17 +0,0 @@ -// 搜索 - -module.exports = (query, request) => { - const data = { - s: query.keywords, - type: query.type || 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频 - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/api/cloudsearch/pc`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/comment.js b/packages/api/module/comment.js deleted file mode 100644 index 9395bf38..00000000 --- a/packages/api/module/comment.js +++ /dev/null @@ -1,36 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -// 发送与删除评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.t = { - 1: 'add', - 0: 'delete', - 2: 'reply', - }[query.t] - query.type = resourceTypeMap[query.type] - const data = { - threadId: query.type + query.id, - } - - if (query.type == 'A_EV_2_') { - data.threadId = query.threadId - } - if (query.t == 'add') data.content = query.content - else if (query.t == 'delete') data.commentId = query.commentId - else if (query.t == 'reply') { - data.commentId = query.commentId - data.content = query.content - } - return request( - 'POST', - `https://music.163.com/weapi/resource/comments/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_album.js b/packages/api/module/comment_album.js deleted file mode 100644 index d701d2d2..00000000 --- a/packages/api/module/comment_album.js +++ /dev/null @@ -1,22 +0,0 @@ -// 专辑评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/R_AL_3_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_dj.js b/packages/api/module/comment_dj.js deleted file mode 100644 index 70b7dbf2..00000000 --- a/packages/api/module/comment_dj.js +++ /dev/null @@ -1,22 +0,0 @@ -// 电台评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/A_DJ_1_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_event.js b/packages/api/module/comment_event.js deleted file mode 100644 index 460a5609..00000000 --- a/packages/api/module/comment_event.js +++ /dev/null @@ -1,20 +0,0 @@ -// 获取动态评论 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/${query.threadId}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_floor.js b/packages/api/module/comment_floor.js deleted file mode 100644 index de284708..00000000 --- a/packages/api/module/comment_floor.js +++ /dev/null @@ -1,21 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -module.exports = (query, request) => { - query.type = resourceTypeMap[query.type] - const data = { - parentCommentId: query.parentCommentId, - threadId: query.type + query.id, - time: query.time || -1, - limit: query.limit || 20, - } - return request( - 'POST', - `https://music.163.com/api/resource/comment/floor/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_hot.js b/packages/api/module/comment_hot.js deleted file mode 100644 index 48586786..00000000 --- a/packages/api/module/comment_hot.js +++ /dev/null @@ -1,24 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -// 热门评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.type = resourceTypeMap[query.type] - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/hotcomments/${query.type}${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_hug_list.js b/packages/api/module/comment_hug_list.js deleted file mode 100644 index 394a2df4..00000000 --- a/packages/api/module/comment_hug_list.js +++ /dev/null @@ -1,27 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - query.type = resourceTypeMap[query.type || 0] - const threadId = query.type + query.sid - const data = { - targetUserId: query.uid, - commentId: query.cid, - cursor: query.cursor || '-1', - threadId: threadId, - pageNo: query.page || 1, - idCursor: query.idCursor || -1, - pageSize: query.pageSize || 100, - } - return request( - 'POST', - `https://music.163.com/api/v2/resource/comments/hug/list`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_like.js b/packages/api/module/comment_like.js deleted file mode 100644 index fa382a8f..00000000 --- a/packages/api/module/comment_like.js +++ /dev/null @@ -1,26 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -// 点赞与取消点赞评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.t = query.t == 1 ? 'like' : 'unlike' - query.type = resourceTypeMap[query.type] - const data = { - threadId: query.type + query.id, - commentId: query.cid, - } - if (query.type == 'A_EV_2_') { - data.threadId = query.threadId - } - return request( - 'POST', - `https://music.163.com/weapi/v1/comment/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_music.js b/packages/api/module/comment_music.js deleted file mode 100644 index 9fbc8f1a..00000000 --- a/packages/api/module/comment_music.js +++ /dev/null @@ -1,22 +0,0 @@ -// 歌曲评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/api/v1/resource/comments/R_SO_4_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_mv.js b/packages/api/module/comment_mv.js deleted file mode 100644 index 979c035c..00000000 --- a/packages/api/module/comment_mv.js +++ /dev/null @@ -1,22 +0,0 @@ -// MV评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/R_MV_5_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_new.js b/packages/api/module/comment_new.js deleted file mode 100644 index ad3cb0b5..00000000 --- a/packages/api/module/comment_new.js +++ /dev/null @@ -1,31 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -// 评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.type = resourceTypeMap[query.type] - const threadId = query.type + query.id - const pageSize = query.pageSize || 20 - const pageNo = query.pageNo || 1 - const data = { - threadId: threadId, - pageNo, - showInner: query.showInner || true, - pageSize, - cursor: - +query.sortType === 3 ? query.cursor || '0' : (pageNo - 1) * pageSize, - sortType: query.sortType || 1, //1:按推荐排序,2:按热度排序,3:按时间排序 - } - return request( - 'POST', - `https://music.163.com/api/v2/resource/comments`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/v2/resource/comments', - }, - ) -} diff --git a/packages/api/module/comment_playlist.js b/packages/api/module/comment_playlist.js deleted file mode 100644 index 52fc5449..00000000 --- a/packages/api/module/comment_playlist.js +++ /dev/null @@ -1,22 +0,0 @@ -// 歌单评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/A_PL_0_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/comment_video.js b/packages/api/module/comment_video.js deleted file mode 100644 index ae015a9b..00000000 --- a/packages/api/module/comment_video.js +++ /dev/null @@ -1,22 +0,0 @@ -// 视频评论 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/R_VI_62_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/countries_code_list.js b/packages/api/module/countries_code_list.js deleted file mode 100644 index 15a76b6f..00000000 --- a/packages/api/module/countries_code_list.js +++ /dev/null @@ -1,16 +0,0 @@ -// 国家编码列表 -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://interface3.music.163.com/eapi/lbs/countries/v1`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/lbs/countries/v1', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/daily_signin.js b/packages/api/module/daily_signin.js deleted file mode 100644 index 2bb7deef..00000000 --- a/packages/api/module/daily_signin.js +++ /dev/null @@ -1,20 +0,0 @@ -// 签到 - -/* - 0为安卓端签到 3点经验, 1为网页签到,2点经验 - 签到成功 {'android': {'point': 3, 'code': 200}, 'web': {'point': 2, 'code': 200}} - 重复签到 {'android': {'code': -2, 'msg': '重复签到'}, 'web': {'code': -2, 'msg': '重复签到'}} - 未登录 {'android': {'code': 301}, 'web': {'code': 301}} -*/ - -module.exports = (query, request) => { - const data = { - type: query.type || 0, - } - return request('POST', `https://music.163.com/weapi/point/dailyTask`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/digitalAlbum_ordering.js b/packages/api/module/digitalAlbum_ordering.js deleted file mode 100644 index 471d95be..00000000 --- a/packages/api/module/digitalAlbum_ordering.js +++ /dev/null @@ -1,27 +0,0 @@ -// 购买数字专辑 - -module.exports = (query, request) => { - const data = { - business: 'Album', - paymentMethod: query.payment, - digitalResources: JSON.stringify([ - { - business: 'Album', - resourceID: query.id, - quantity: query.quantity, - }, - ]), - from: 'web', - } - return request( - 'POST', - `https://music.163.com/api/ordering/web/digital`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/digitalAlbum_purchased.js b/packages/api/module/digitalAlbum_purchased.js deleted file mode 100644 index 362dee1b..00000000 --- a/packages/api/module/digitalAlbum_purchased.js +++ /dev/null @@ -1,20 +0,0 @@ -// 我的数字专辑 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - } - return request( - 'POST', - `https://music.163.com/api/digitalAlbum/purchased`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_banner.js b/packages/api/module/dj_banner.js deleted file mode 100644 index 1ec17ba1..00000000 --- a/packages/api/module/dj_banner.js +++ /dev/null @@ -1,17 +0,0 @@ -// 电台banner - -module.exports = (query, request) => { - const data = {} - query.cookie.os = 'pc' - return request( - 'POST', - `https://music.163.com/weapi/djradio/banner/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_category_excludehot.js b/packages/api/module/dj_category_excludehot.js deleted file mode 100644 index cfd42666..00000000 --- a/packages/api/module/dj_category_excludehot.js +++ /dev/null @@ -1,15 +0,0 @@ -// 电台非热门类型 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/category/excludehot`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_category_recommend.js b/packages/api/module/dj_category_recommend.js deleted file mode 100644 index a0e4bf14..00000000 --- a/packages/api/module/dj_category_recommend.js +++ /dev/null @@ -1,15 +0,0 @@ -// 电台推荐类型 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/home/category/recommend`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_catelist.js b/packages/api/module/dj_catelist.js deleted file mode 100644 index 8866be40..00000000 --- a/packages/api/module/dj_catelist.js +++ /dev/null @@ -1,15 +0,0 @@ -// 电台分类列表 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/category/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_detail.js b/packages/api/module/dj_detail.js deleted file mode 100644 index 941024b0..00000000 --- a/packages/api/module/dj_detail.js +++ /dev/null @@ -1,13 +0,0 @@ -// 电台详情 - -module.exports = (query, request) => { - const data = { - id: query.rid, - } - return request('POST', `https://music.163.com/api/djradio/v2/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_hot.js b/packages/api/module/dj_hot.js deleted file mode 100644 index 5f7e30f0..00000000 --- a/packages/api/module/dj_hot.js +++ /dev/null @@ -1,14 +0,0 @@ -// 热门电台 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - } - return request('POST', `https://music.163.com/weapi/djradio/hot/v1`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_paygift.js b/packages/api/module/dj_paygift.js deleted file mode 100644 index 4424ab99..00000000 --- a/packages/api/module/dj_paygift.js +++ /dev/null @@ -1,19 +0,0 @@ -// 付费电台 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/djradio/home/paygift/list?_nmclfl=1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_personalize_recommend.js b/packages/api/module/dj_personalize_recommend.js deleted file mode 100644 index b8d7570a..00000000 --- a/packages/api/module/dj_personalize_recommend.js +++ /dev/null @@ -1,17 +0,0 @@ -// 电台个性推荐 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/djradio/personalize/rcmd`, - { - limit: query.limit || 6, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_program.js b/packages/api/module/dj_program.js deleted file mode 100644 index a0fa6469..00000000 --- a/packages/api/module/dj_program.js +++ /dev/null @@ -1,21 +0,0 @@ -// 电台节目列表 -const { toBoolean } = require('../util') -module.exports = (query, request) => { - const data = { - radioId: query.rid, - limit: query.limit || 30, - offset: query.offset || 0, - asc: toBoolean(query.asc), - } - return request( - 'POST', - `https://music.163.com/weapi/dj/program/byradio`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_program_detail.js b/packages/api/module/dj_program_detail.js deleted file mode 100644 index 70f3d2e3..00000000 --- a/packages/api/module/dj_program_detail.js +++ /dev/null @@ -1,13 +0,0 @@ -// 电台节目详情 - -module.exports = (query, request) => { - const data = { - id: query.id, - } - return request('POST', `https://music.163.com/api/dj/program/detail`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_program_toplist.js b/packages/api/module/dj_program_toplist.js deleted file mode 100644 index 898cf9d1..00000000 --- a/packages/api/module/dj_program_toplist.js +++ /dev/null @@ -1,14 +0,0 @@ -// 电台节目榜 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - offset: query.offset || 0, - } - return request('POST', `https://music.163.com/api/program/toplist/v1`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_program_toplist_hours.js b/packages/api/module/dj_program_toplist_hours.js deleted file mode 100644 index 4547636c..00000000 --- a/packages/api/module/dj_program_toplist_hours.js +++ /dev/null @@ -1,18 +0,0 @@ -// 电台24小时节目榜 -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - // 不支持 offset - } - return request( - 'POST', - `https://music.163.com/api/djprogram/toplist/hours`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_radio_hot.js b/packages/api/module/dj_radio_hot.js deleted file mode 100644 index 30e0b42e..00000000 --- a/packages/api/module/dj_radio_hot.js +++ /dev/null @@ -1,15 +0,0 @@ -// 类别热门电台 - -module.exports = (query, request) => { - const data = { - cateId: query.cateId, - limit: query.limit || 30, - offset: query.offset || 0, - } - return request('POST', `https://music.163.com/api/djradio/hot`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_recommend.js b/packages/api/module/dj_recommend.js deleted file mode 100644 index e23b0569..00000000 --- a/packages/api/module/dj_recommend.js +++ /dev/null @@ -1,15 +0,0 @@ -// 精选电台 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/recommend/v1`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_recommend_type.js b/packages/api/module/dj_recommend_type.js deleted file mode 100644 index 6f3df614..00000000 --- a/packages/api/module/dj_recommend_type.js +++ /dev/null @@ -1,41 +0,0 @@ -// 精选电台分类 - -/* - 有声书 10001 - 知识技能 453050 - 商业财经 453051 - 人文历史 11 - 外语世界 13 - 亲子宝贝 14 - 创作|翻唱 2001 - 音乐故事 2 - 3D|电子 10002 - 相声曲艺 8 - 情感调频 3 - 美文读物 6 - 脱口秀 5 - 广播剧 7 - 二次元 3001 - 明星做主播 1 - 娱乐|影视 4 - 科技科学 453052 - 校园|教育 4001 - 旅途|城市 12 -*/ - -module.exports = (query, request) => { - const data = { - cateId: query.type, - } - return request( - 'POST', - `https://music.163.com/weapi/djradio/recommend`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_sub.js b/packages/api/module/dj_sub.js deleted file mode 100644 index cec5ad79..00000000 --- a/packages/api/module/dj_sub.js +++ /dev/null @@ -1,19 +0,0 @@ -// 订阅与取消电台 - -module.exports = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub' - const data = { - id: query.rid, - } - return request( - 'POST', - `https://music.163.com/weapi/djradio/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_sublist.js b/packages/api/module/dj_sublist.js deleted file mode 100644 index 6d4bcf26..00000000 --- a/packages/api/module/dj_sublist.js +++ /dev/null @@ -1,20 +0,0 @@ -// 订阅电台列表 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - } - return request( - 'POST', - `https://music.163.com/weapi/djradio/get/subed`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_subscriber.js b/packages/api/module/dj_subscriber.js deleted file mode 100644 index 0760834a..00000000 --- a/packages/api/module/dj_subscriber.js +++ /dev/null @@ -1,16 +0,0 @@ -// 电台详情 - -module.exports = (query, request) => { - const data = { - time: query.time || '-1', - id: query.id, - limit: query.limit || '20', - total: 'true', - } - return request('POST', `https://music.163.com/api/djradio/subscriber`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_today_perfered.js b/packages/api/module/dj_today_perfered.js deleted file mode 100644 index a4881c8b..00000000 --- a/packages/api/module/dj_today_perfered.js +++ /dev/null @@ -1,18 +0,0 @@ -// 电台今日优选 - -module.exports = (query, request) => { - const data = { - page: query.page || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/djradio/home/today/perfered`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_toplist.js b/packages/api/module/dj_toplist.js deleted file mode 100644 index cbe04d76..00000000 --- a/packages/api/module/dj_toplist.js +++ /dev/null @@ -1,18 +0,0 @@ -// 新晋电台榜/热门电台榜 -const typeMap = { - new: 0, - hot: 1, -} -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - offset: query.offset || 0, - type: typeMap[query.type || 'new'] || '0', //0为新晋,1为热门 - } - return request('POST', `https://music.163.com/api/djradio/toplist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_toplist_hours.js b/packages/api/module/dj_toplist_hours.js deleted file mode 100644 index 8c8b6a37..00000000 --- a/packages/api/module/dj_toplist_hours.js +++ /dev/null @@ -1,14 +0,0 @@ -// 电台24小时主播榜 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - // 不支持 offset - } - return request('POST', `https://music.163.com/api/dj/toplist/hours`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/dj_toplist_newcomer.js b/packages/api/module/dj_toplist_newcomer.js deleted file mode 100644 index 8f28511c..00000000 --- a/packages/api/module/dj_toplist_newcomer.js +++ /dev/null @@ -1,18 +0,0 @@ -// 电台新人榜 -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/api/dj/toplist/newcomer`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_toplist_pay.js b/packages/api/module/dj_toplist_pay.js deleted file mode 100644 index 5e6caf36..00000000 --- a/packages/api/module/dj_toplist_pay.js +++ /dev/null @@ -1,18 +0,0 @@ -// 付费精品 -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - // 不支持 offset - } - return request( - 'POST', - `https://music.163.com/api/djradio/toplist/pay`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/dj_toplist_popular.js b/packages/api/module/dj_toplist_popular.js deleted file mode 100644 index fcb0b33c..00000000 --- a/packages/api/module/dj_toplist_popular.js +++ /dev/null @@ -1,14 +0,0 @@ -// 电台最热主播榜 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 100, - // 不支持 offset - } - return request('POST', `https://music.163.com/api/dj/toplist/popular`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/event.js b/packages/api/module/event.js deleted file mode 100644 index b975ab72..00000000 --- a/packages/api/module/event.js +++ /dev/null @@ -1,14 +0,0 @@ -// 动态 - -module.exports = (query, request) => { - const data = { - pagesize: query.pagesize || 20, - lasttime: query.lasttime || -1, - } - return request('POST', `https://music.163.com/weapi/v1/event/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/event_del.js b/packages/api/module/event_del.js deleted file mode 100644 index 8f17ebeb..00000000 --- a/packages/api/module/event_del.js +++ /dev/null @@ -1,13 +0,0 @@ -// 删除动态 - -module.exports = (query, request) => { - const data = { - id: query.evId, - } - return request('POST', `https://music.163.com/eapi/event/delete`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/event_forward.js b/packages/api/module/event_forward.js deleted file mode 100644 index ccdc0704..00000000 --- a/packages/api/module/event_forward.js +++ /dev/null @@ -1,16 +0,0 @@ -// 转发动态 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - forwards: query.forwards, - id: query.evId, - eventUserId: query.uid, - } - return request('POST', `https://music.163.com/weapi/event/forward`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/fm_trash.js b/packages/api/module/fm_trash.js deleted file mode 100644 index a2019d7d..00000000 --- a/packages/api/module/fm_trash.js +++ /dev/null @@ -1,20 +0,0 @@ -// 垃圾桶 - -module.exports = (query, request) => { - const data = { - songId: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/radio/trash/add?alg=RT&songId=${ - query.id - }&time=${query.time || 25}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/follow.js b/packages/api/module/follow.js deleted file mode 100644 index d14acf03..00000000 --- a/packages/api/module/follow.js +++ /dev/null @@ -1,17 +0,0 @@ -// 关注与取消关注用户 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.t = query.t == 1 ? 'follow' : 'delfollow' - return request( - 'POST', - `https://music.163.com/weapi/user/${query.t}/${query.id}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/history_recommend_songs.js b/packages/api/module/history_recommend_songs.js deleted file mode 100644 index de282c07..00000000 --- a/packages/api/module/history_recommend_songs.js +++ /dev/null @@ -1,17 +0,0 @@ -// 历史每日推荐歌曲 - -module.exports = (query, request) => { - query.cookie.os = 'ios' - const data = {} - return request( - 'POST', - `https://music.163.com/api/discovery/recommend/songs/history/recent`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/history_recommend_songs_detail.js b/packages/api/module/history_recommend_songs_detail.js deleted file mode 100644 index d98c8698..00000000 --- a/packages/api/module/history_recommend_songs_detail.js +++ /dev/null @@ -1,19 +0,0 @@ -// 历史每日推荐歌曲详情 - -module.exports = (query, request) => { - query.cookie.os = 'ios' - const data = { - date: query.date || '', - } - return request( - 'POST', - `https://music.163.com/api/discovery/recommend/songs/history/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/homepage_block_page.js b/packages/api/module/homepage_block_page.js deleted file mode 100644 index 618e5349..00000000 --- a/packages/api/module/homepage_block_page.js +++ /dev/null @@ -1,19 +0,0 @@ -// 首页-发现 block page -// 这个接口为移动端接口,首页-发现页,数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L259 HomeBlockPageWrap -// query.refresh 是否刷新数据 -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - const data = { refresh: query.refresh || true } - return request( - 'POST', - `https://music.163.com/api/homepage/block/page`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/homepage_dragon_ball.js b/packages/api/module/homepage_dragon_ball.js deleted file mode 100644 index 00231dd5..00000000 --- a/packages/api/module/homepage_dragon_ball.js +++ /dev/null @@ -1,24 +0,0 @@ -// 首页-发现 dragon ball -// 这个接口为移动端接口,首页-发现页(每日推荐、歌单、排行榜 那些入口) -// 数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L290 HomeDragonBallWrap -// !需要登录或者匿名登录,非登录返回 [] -const config = require('../util/config.json') -module.exports = (query, request) => { - if (!('MUSIC_U' in query.cookie)) - query.cookie.MUSIC_A = config.anonymous_token - const data = {} - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - return request( - 'POST', - `https://music.163.com/eapi/homepage/dragon/ball/static`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/homepage/dragon/ball/static', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/hot_topic.js b/packages/api/module/hot_topic.js deleted file mode 100644 index f9014921..00000000 --- a/packages/api/module/hot_topic.js +++ /dev/null @@ -1,14 +0,0 @@ -//热门话题 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 20, - offset: query.offset || 0, - } - return request('POST', `https://music.163.com/api/act/hot`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/hug_comment.js b/packages/api/module/hug_comment.js deleted file mode 100644 index ce445288..00000000 --- a/packages/api/module/hug_comment.js +++ /dev/null @@ -1,23 +0,0 @@ -const { resourceTypeMap } = require('../util/config.json') -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - query.type = resourceTypeMap[query.type || 0] - const threadId = query.type + query.sid - const data = { - targetUserId: query.uid, - commentId: query.cid, - threadId: threadId, - } - return request( - 'POST', - `https://music.163.com/api/v2/resource/comments/hug/listener`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/like.js b/packages/api/module/like.js deleted file mode 100644 index bd905918..00000000 --- a/packages/api/module/like.js +++ /dev/null @@ -1,19 +0,0 @@ -// 红心与取消红心歌曲 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.cookie.appver = '2.7.1.198277' - query.like = query.like == 'false' ? false : true - const data = { - alg: 'itembased', - trackId: query.id, - like: query.like, - time: '3', - } - return request('POST', `https://music.163.com/api/radio/like`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/likelist.js b/packages/api/module/likelist.js deleted file mode 100644 index abb46809..00000000 --- a/packages/api/module/likelist.js +++ /dev/null @@ -1,13 +0,0 @@ -// 喜欢的歌曲(无序) - -module.exports = (query, request) => { - const data = { - uid: query.uid, - } - return request('POST', `https://music.163.com/weapi/song/like/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/listen_together_status.js b/packages/api/module/listen_together_status.js deleted file mode 100644 index 61fd9026..00000000 --- a/packages/api/module/listen_together_status.js +++ /dev/null @@ -1,15 +0,0 @@ -// 一起听状态 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/listen/together/status/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/login.js b/packages/api/module/login.js deleted file mode 100644 index 44787ce5..00000000 --- a/packages/api/module/login.js +++ /dev/null @@ -1,47 +0,0 @@ -// 邮箱登录 - -const crypto = require('crypto') - -module.exports = async (query, request) => { - query.cookie.os = 'pc' - const data = { - username: query.email, - password: - query.md5_password || - crypto.createHash('md5').update(query.password).digest('hex'), - rememberLogin: 'true', - } - let result = await request( - 'POST', - `https://music.163.com/weapi/login`, - data, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - if (result.body.code === 502) { - return { - status: 200, - body: { - msg: '账号或密码错误', - code: 502, - message: '账号或密码错误', - }, - } - } - if (result.body.code === 200) { - result = { - status: 200, - body: { - ...result.body, - cookie: result.cookie.join(';'), - }, - cookie: result.cookie, - } - } - return result -} diff --git a/packages/api/module/login_cellphone.js b/packages/api/module/login_cellphone.js deleted file mode 100644 index 0d2e7aed..00000000 --- a/packages/api/module/login_cellphone.js +++ /dev/null @@ -1,39 +0,0 @@ -// 手机登录 - -const crypto = require('crypto') - -module.exports = async (query, request) => { - query.cookie.os = 'pc' - const data = { - phone: query.phone, - countrycode: query.countrycode || '86', - password: - query.md5_password || - crypto.createHash('md5').update(query.password).digest('hex'), - rememberLogin: 'true', - } - let result = await request( - 'POST', - `https://music.163.com/weapi/login/cellphone`, - data, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - - if (result.body.code === 200) { - result = { - status: 200, - body: { - ...result.body, - cookie: result.cookie.join(';'), - }, - cookie: result.cookie, - } - } - return result -} diff --git a/packages/api/module/login_qr_check.js b/packages/api/module/login_qr_check.js deleted file mode 100644 index 9c396e2e..00000000 --- a/packages/api/module/login_qr_check.js +++ /dev/null @@ -1,34 +0,0 @@ -module.exports = async (query, request) => { - const data = { - key: query.key, - type: 1, - } - try { - let result = await request( - 'POST', - `https://music.163.com/weapi/login/qrcode/client/login`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - result = { - status: 200, - body: { - ...result.body, - cookie: result.cookie.join(';'), - }, - cookie: result.cookie, - } - return result - } catch (error) { - return { - status: 200, - body: {}, - cookie: result.cookie, - } - } -} diff --git a/packages/api/module/login_qr_create.js b/packages/api/module/login_qr_create.js deleted file mode 100644 index aeb6943a..00000000 --- a/packages/api/module/login_qr_create.js +++ /dev/null @@ -1,18 +0,0 @@ -const QRCode = require('qrcode') - -module.exports = (query, request) => { - return new Promise(async (resolve) => { - const url = `https://music.163.com/login?codekey=${query.key}` - return resolve({ - code: 200, - status: 200, - body: { - code: 200, - data: { - qrurl: url, - qrimg: query.qrimg ? await QRCode.toDataURL(url) : '', - }, - }, - }) - }) -} diff --git a/packages/api/module/login_qr_key.js b/packages/api/module/login_qr_key.js deleted file mode 100644 index bbee4be3..00000000 --- a/packages/api/module/login_qr_key.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = async (query, request) => { - const data = { - type: 1, - } - const result = await request( - 'POST', - `https://music.163.com/weapi/login/qrcode/unikey`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - return { - status: 200, - body: { - data: result.body, - code: 200, - }, - cookie: result.cookie, - } -} diff --git a/packages/api/module/login_refresh.js b/packages/api/module/login_refresh.js deleted file mode 100644 index ac2b6a6c..00000000 --- a/packages/api/module/login_refresh.js +++ /dev/null @@ -1,16 +0,0 @@ -// 登录刷新 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/login/token/refresh`, - {}, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/login_status.js b/packages/api/module/login_status.js deleted file mode 100644 index 23286bc6..00000000 --- a/packages/api/module/login_status.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = async (query, request) => { - const data = {} - let result = await request( - 'POST', - `https://music.163.com/weapi/w/nuser/account/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - if (result.body.code === 200) { - result = { - status: 200, - body: { - data: { - ...result.body, - }, - }, - cookie: result.cookie, - } - } - return result -} diff --git a/packages/api/module/logout.js b/packages/api/module/logout.js deleted file mode 100644 index a92ce473..00000000 --- a/packages/api/module/logout.js +++ /dev/null @@ -1,16 +0,0 @@ -// 退出登录 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/logout`, - {}, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/lyric.js b/packages/api/module/lyric.js deleted file mode 100644 index c3e87214..00000000 --- a/packages/api/module/lyric.js +++ /dev/null @@ -1,17 +0,0 @@ -// 歌词 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - id: query.id, - lv: -1, - kv: -1, - tv: -1, - } - return request('POST', `https://music.163.com/api/song/lyric`, data, { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/msg_comments.js b/packages/api/module/msg_comments.js deleted file mode 100644 index 76bab8fc..00000000 --- a/packages/api/module/msg_comments.js +++ /dev/null @@ -1,22 +0,0 @@ -// 评论 - -module.exports = (query, request) => { - const data = { - beforeTime: query.before || '-1', - limit: query.limit || 30, - total: 'true', - uid: query.uid, - } - - return request( - 'POST', - `https://music.163.com/api/v1/user/comments/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/msg_forwards.js b/packages/api/module/msg_forwards.js deleted file mode 100644 index f89dc989..00000000 --- a/packages/api/module/msg_forwards.js +++ /dev/null @@ -1,15 +0,0 @@ -// @我 - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - total: 'true', - } - return request('POST', `https://music.163.com/api/forwards/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/msg_notices.js b/packages/api/module/msg_notices.js deleted file mode 100644 index 9208168b..00000000 --- a/packages/api/module/msg_notices.js +++ /dev/null @@ -1,14 +0,0 @@ -// 通知 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - time: query.lasttime || -1, - } - return request('POST', `https://music.163.com/api/msg/notices`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/msg_private.js b/packages/api/module/msg_private.js deleted file mode 100644 index a30751c6..00000000 --- a/packages/api/module/msg_private.js +++ /dev/null @@ -1,15 +0,0 @@ -// 私信 - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - total: 'true', - } - return request('POST', `https://music.163.com/api/msg/private/users`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/msg_private_history.js b/packages/api/module/msg_private_history.js deleted file mode 100644 index 0a83b021..00000000 --- a/packages/api/module/msg_private_history.js +++ /dev/null @@ -1,21 +0,0 @@ -// 私信内容 - -module.exports = (query, request) => { - const data = { - userId: query.uid, - limit: query.limit || 30, - time: query.before || 0, - total: 'true', - } - return request( - 'POST', - `https://music.163.com/api/msg/private/history`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/msg_recentcontact.js b/packages/api/module/msg_recentcontact.js deleted file mode 100644 index cb17c3a6..00000000 --- a/packages/api/module/msg_recentcontact.js +++ /dev/null @@ -1,16 +0,0 @@ -// 最近联系 - -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/msg/recentcontact/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/mv_all.js b/packages/api/module/mv_all.js deleted file mode 100644 index 85c1c464..00000000 --- a/packages/api/module/mv_all.js +++ /dev/null @@ -1,20 +0,0 @@ -// 全部MV - -module.exports = (query, request) => { - const data = { - tags: JSON.stringify({ - 地区: query.area || '全部', - 类型: query.type || '全部', - 排序: query.order || '上升最快', - }), - offset: query.offset || 0, - total: 'true', - limit: query.limit || 30, - } - return request('POST', `https://interface.music.163.com/api/mv/all`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/mv_detail.js b/packages/api/module/mv_detail.js deleted file mode 100644 index e1b0152e..00000000 --- a/packages/api/module/mv_detail.js +++ /dev/null @@ -1,13 +0,0 @@ -// MV详情 - -module.exports = (query, request) => { - const data = { - id: query.mvid, - } - return request('POST', `https://music.163.com/api/v1/mv/detail`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/mv_detail_info.js b/packages/api/module/mv_detail_info.js deleted file mode 100644 index b758a461..00000000 --- a/packages/api/module/mv_detail_info.js +++ /dev/null @@ -1,19 +0,0 @@ -// MV 点赞转发评论数数据 - -module.exports = (query, request) => { - const data = { - threadid: `R_MV_5_${query.mvid}`, - composeliked: true, - } - return request( - 'POST', - `https://music.163.com/api/comment/commentthread/info`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/mv_exclusive_rcmd.js b/packages/api/module/mv_exclusive_rcmd.js deleted file mode 100644 index aee8b2de..00000000 --- a/packages/api/module/mv_exclusive_rcmd.js +++ /dev/null @@ -1,19 +0,0 @@ -// 网易出品 - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - } - return request( - 'POST', - `https://interface.music.163.com/api/mv/exclusive/rcmd`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/mv_first.js b/packages/api/module/mv_first.js deleted file mode 100644 index ae61ad9b..00000000 --- a/packages/api/module/mv_first.js +++ /dev/null @@ -1,21 +0,0 @@ -// 最新MV - -module.exports = (query, request) => { - const data = { - // 'offset': query.offset || 0, - area: query.area || '', - limit: query.limit || 30, - total: true, - } - return request( - 'POST', - `https://interface.music.163.com/weapi/mv/first`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/mv_sub.js b/packages/api/module/mv_sub.js deleted file mode 100644 index 249998e9..00000000 --- a/packages/api/module/mv_sub.js +++ /dev/null @@ -1,15 +0,0 @@ -// 收藏与取消收藏MV - -module.exports = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub' - const data = { - mvId: query.mvid, - mvIds: '["' + query.mvid + '"]', - } - return request('POST', `https://music.163.com/weapi/mv/${query.t}`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/mv_sublist.js b/packages/api/module/mv_sublist.js deleted file mode 100644 index 2118c418..00000000 --- a/packages/api/module/mv_sublist.js +++ /dev/null @@ -1,20 +0,0 @@ -// 已收藏MV列表 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 25, - offset: query.offset || 0, - total: true, - } - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/allvideo/sublist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/mv_url.js b/packages/api/module/mv_url.js deleted file mode 100644 index 1b8c5181..00000000 --- a/packages/api/module/mv_url.js +++ /dev/null @@ -1,19 +0,0 @@ -// MV链接 - -module.exports = (query, request) => { - const data = { - id: query.id, - r: query.r || 1080, - } - return request( - 'POST', - `https://music.163.com/weapi/song/enhance/play/mv/url`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personal_fm.js b/packages/api/module/personal_fm.js deleted file mode 100644 index 72ee1fba..00000000 --- a/packages/api/module/personal_fm.js +++ /dev/null @@ -1,15 +0,0 @@ -// 私人FM - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/radio/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personalized.js b/packages/api/module/personalized.js deleted file mode 100644 index 38a44cad..00000000 --- a/packages/api/module/personalized.js +++ /dev/null @@ -1,21 +0,0 @@ -// 推荐歌单 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - // offset: query.offset || 0, - total: true, - n: 1000, - } - return request( - 'POST', - `https://music.163.com/weapi/personalized/playlist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personalized_djprogram.js b/packages/api/module/personalized_djprogram.js deleted file mode 100644 index aa31dd31..00000000 --- a/packages/api/module/personalized_djprogram.js +++ /dev/null @@ -1,15 +0,0 @@ -// 推荐电台 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/personalized/djprogram`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personalized_mv.js b/packages/api/module/personalized_mv.js deleted file mode 100644 index 362c9b3a..00000000 --- a/packages/api/module/personalized_mv.js +++ /dev/null @@ -1,15 +0,0 @@ -// 推荐MV - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/personalized/mv`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personalized_newsong.js b/packages/api/module/personalized_newsong.js deleted file mode 100644 index 2af12a35..00000000 --- a/packages/api/module/personalized_newsong.js +++ /dev/null @@ -1,21 +0,0 @@ -// 推荐新歌 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - type: 'recommend', - limit: query.limit || 10, - areaId: query.areaId || 0, - } - return request( - 'POST', - `https://music.163.com/api/personalized/newsong`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personalized_privatecontent.js b/packages/api/module/personalized_privatecontent.js deleted file mode 100644 index 56337381..00000000 --- a/packages/api/module/personalized_privatecontent.js +++ /dev/null @@ -1,15 +0,0 @@ -// 独家放送 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/personalized/privatecontent`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/personalized_privatecontent_list.js b/packages/api/module/personalized_privatecontent_list.js deleted file mode 100644 index f9ff49eb..00000000 --- a/packages/api/module/personalized_privatecontent_list.js +++ /dev/null @@ -1,20 +0,0 @@ -// 独家放送列表 - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - total: 'true', - limit: query.limit || 60, - } - return request( - 'POST', - `https://music.163.com/api/v2/privatecontent/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_catlist.js b/packages/api/module/playlist_catlist.js deleted file mode 100644 index 9b148f68..00000000 --- a/packages/api/module/playlist_catlist.js +++ /dev/null @@ -1,15 +0,0 @@ -// 全部歌单分类 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/playlist/catalogue`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_cover_update.js b/packages/api/module/playlist_cover_update.js deleted file mode 100644 index 957b9cc9..00000000 --- a/packages/api/module/playlist_cover_update.js +++ /dev/null @@ -1,28 +0,0 @@ -const uploadPlugin = require('../plugins/upload') -module.exports = async (query, request) => { - const uploadInfo = await uploadPlugin(query, request) - const res = await request( - 'POST', - `https://music.163.com/weapi/playlist/cover/update`, - { - id: query.id, - coverImgId: uploadInfo.imgId, - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - return { - status: 200, - body: { - code: 200, - data: { - ...uploadInfo, - ...res.body, - }, - }, - } -} diff --git a/packages/api/module/playlist_create.js b/packages/api/module/playlist_create.js deleted file mode 100644 index 8a1ae268..00000000 --- a/packages/api/module/playlist_create.js +++ /dev/null @@ -1,16 +0,0 @@ -// 创建歌单 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - name: query.name, - privacy: query.privacy, //0 为普通歌单,10 为隐私歌单 - type: query.type || 'NORMAL', // NORMAL|VIDEO - } - return request('POST', `https://music.163.com/api/playlist/create`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/playlist_delete.js b/packages/api/module/playlist_delete.js deleted file mode 100644 index d388a0eb..00000000 --- a/packages/api/module/playlist_delete.js +++ /dev/null @@ -1,14 +0,0 @@ -// 删除歌单 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - ids: '[' + query.id + ']', - } - return request('POST', `https://music.163.com/weapi/playlist/remove`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/playlist_desc_update.js b/packages/api/module/playlist_desc_update.js deleted file mode 100644 index bebd9bb7..00000000 --- a/packages/api/module/playlist_desc_update.js +++ /dev/null @@ -1,20 +0,0 @@ -// 更新歌单描述 - -module.exports = (query, request) => { - const data = { - id: query.id, - desc: query.desc, - } - return request( - 'POST', - `https://interface3.music.163.com/eapi/playlist/desc/update`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/desc/update', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_detail.js b/packages/api/module/playlist_detail.js deleted file mode 100644 index 39718f7f..00000000 --- a/packages/api/module/playlist_detail.js +++ /dev/null @@ -1,15 +0,0 @@ -// 歌单详情 - -module.exports = (query, request) => { - const data = { - id: query.id, - n: 100000, - s: query.s || 8, - } - return request('POST', `https://music.163.com/api/v6/playlist/detail`, data, { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/playlist_detail_dynamic.js b/packages/api/module/playlist_detail_dynamic.js deleted file mode 100644 index e3362d2c..00000000 --- a/packages/api/module/playlist_detail_dynamic.js +++ /dev/null @@ -1,20 +0,0 @@ -// 初始化名字 - -module.exports = (query, request) => { - const data = { - id: query.id, - n: 100000, - s: query.s || 8, - } - return request( - 'POST', - `https://music.163.com/api/playlist/detail/dynamic`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_highquality_tags.js b/packages/api/module/playlist_highquality_tags.js deleted file mode 100644 index 0848c523..00000000 --- a/packages/api/module/playlist_highquality_tags.js +++ /dev/null @@ -1,15 +0,0 @@ -// 精品歌单 tags -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/playlist/highquality/tags`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_hot.js b/packages/api/module/playlist_hot.js deleted file mode 100644 index 6c085e43..00000000 --- a/packages/api/module/playlist_hot.js +++ /dev/null @@ -1,15 +0,0 @@ -// 热门歌单分类 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/playlist/hottags`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_mylike.js b/packages/api/module/playlist_mylike.js deleted file mode 100644 index 779b507f..00000000 --- a/packages/api/module/playlist_mylike.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = (query, request) => { - const data = { - time: query.time || '-1', - limit: query.limit || '12', - } - return request( - 'POST', - `https://music.163.com/api/mlog/playlist/mylike/bytime/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_name_update.js b/packages/api/module/playlist_name_update.js deleted file mode 100644 index ae539466..00000000 --- a/packages/api/module/playlist_name_update.js +++ /dev/null @@ -1,20 +0,0 @@ -// 更新歌单名 - -module.exports = (query, request) => { - const data = { - id: query.id, - name: query.name, - } - return request( - 'POST', - `https://interface3.music.163.com/eapi/playlist/update/name`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/update/name', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_order_update.js b/packages/api/module/playlist_order_update.js deleted file mode 100644 index 268c6ead..00000000 --- a/packages/api/module/playlist_order_update.js +++ /dev/null @@ -1,19 +0,0 @@ -// 编辑歌单顺序 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - ids: query.ids, - } - return request( - 'POST', - `https://music.163.com/api/playlist/order/update`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_subscribe.js b/packages/api/module/playlist_subscribe.js deleted file mode 100644 index e0cce162..00000000 --- a/packages/api/module/playlist_subscribe.js +++ /dev/null @@ -1,19 +0,0 @@ -// 收藏与取消收藏歌单 - -module.exports = (query, request) => { - query.t = query.t == 1 ? 'subscribe' : 'unsubscribe' - const data = { - id: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/playlist/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_subscribers.js b/packages/api/module/playlist_subscribers.js deleted file mode 100644 index 04260cb9..00000000 --- a/packages/api/module/playlist_subscribers.js +++ /dev/null @@ -1,20 +0,0 @@ -// 歌单收藏者 - -module.exports = (query, request) => { - const data = { - id: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/playlist/subscribers`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_tags_update.js b/packages/api/module/playlist_tags_update.js deleted file mode 100644 index 44de8c63..00000000 --- a/packages/api/module/playlist_tags_update.js +++ /dev/null @@ -1,20 +0,0 @@ -// 更新歌单标签 - -module.exports = (query, request) => { - const data = { - id: query.id, - tags: query.tags, - } - return request( - 'POST', - `https://interface3.music.163.com/eapi/playlist/tags/update`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/tags/update', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_track_add.js b/packages/api/module/playlist_track_add.js deleted file mode 100644 index c2391f3c..00000000 --- a/packages/api/module/playlist_track_add.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = async (query, request) => { - query.cookie.os = 'pc' - query.ids = query.ids || '' - const data = { - id: query.pid, - tracks: JSON.stringify( - query.ids.split(',').map((item) => { - return { type: 3, id: item } - }), - ), - } - console.log(data) - - return request('POST', `https://music.163.com/api/playlist/track/add`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/playlist_track_delete.js b/packages/api/module/playlist_track_delete.js deleted file mode 100644 index 54ef409a..00000000 --- a/packages/api/module/playlist_track_delete.js +++ /dev/null @@ -1,26 +0,0 @@ -// 收藏单曲到歌单 从歌单删除歌曲 - -module.exports = async (query, request) => { - query.cookie.os = 'pc' - query.ids = query.ids || '' - const data = { - id: query.id, - tracks: JSON.stringify( - query.ids.split(',').map((item) => { - return { type: 3, id: item } - }), - ), - } - - return request( - 'POST', - `https://music.163.com/api/playlist/track/delete`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playlist_tracks.js b/packages/api/module/playlist_tracks.js deleted file mode 100644 index be70c7ca..00000000 --- a/packages/api/module/playlist_tracks.js +++ /dev/null @@ -1,56 +0,0 @@ -// 收藏单曲到歌单 从歌单删除歌曲 - -module.exports = async (query, request) => { - query.cookie.os = 'pc' - const tracks = query.tracks.split(',') - const data = { - op: query.op, // del,add - pid: query.pid, // 歌单id - trackIds: JSON.stringify(tracks), // 歌曲id - imme: 'true', - } - - try { - const res = await request( - 'POST', - `https://music.163.com/api/playlist/manipulate/tracks`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - return { - status: 200, - body: { - ...res, - }, - } - } catch (error) { - if (error.body.code === 512) { - return request( - 'POST', - `https://music.163.com/api/playlist/manipulate/tracks`, - { - op: query.op, // del,add - pid: query.pid, // 歌单id - trackIds: JSON.stringify([...tracks, ...tracks]), - imme: 'true', - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - } else if (error.body.code === 521) { - return { - status: 200, - body: error.body, - } - } - } -} diff --git a/packages/api/module/playlist_update.js b/packages/api/module/playlist_update.js deleted file mode 100644 index 085d195e..00000000 --- a/packages/api/module/playlist_update.js +++ /dev/null @@ -1,18 +0,0 @@ -// 编辑歌单 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.desc = query.desc || '' - query.tags = query.tags || '' - const data = { - '/api/playlist/desc/update': `{"id":${query.id},"desc":"${query.desc}"}`, - '/api/playlist/tags/update': `{"id":${query.id},"tags":"${query.tags}"}`, - '/api/playlist/update/name': `{"id":${query.id},"name":"${query.name}"}`, - } - return request('POST', `https://music.163.com/weapi/batch`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/playlist_video_recent.js b/packages/api/module/playlist_video_recent.js deleted file mode 100644 index 14302113..00000000 --- a/packages/api/module/playlist_video_recent.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/playlist/video/recent`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/playmode_intelligence_list.js b/packages/api/module/playmode_intelligence_list.js deleted file mode 100644 index 81b61ba1..00000000 --- a/packages/api/module/playmode_intelligence_list.js +++ /dev/null @@ -1,22 +0,0 @@ -// 智能播放 - -module.exports = (query, request) => { - const data = { - songId: query.id, - type: 'fromPlayOne', - playlistId: query.pid, - startMusicId: query.sid || query.id, - count: query.count || 1, - } - return request( - 'POST', - `https://music.163.com/weapi/playmode/intelligence/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/program_recommend.js b/packages/api/module/program_recommend.js deleted file mode 100644 index bd63e7aa..00000000 --- a/packages/api/module/program_recommend.js +++ /dev/null @@ -1,20 +0,0 @@ -// 推荐节目 - -module.exports = (query, request) => { - const data = { - cateId: query.type, - limit: query.limit || 10, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/program/recommend/v1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/rebind.js b/packages/api/module/rebind.js deleted file mode 100644 index 053bcbaa..00000000 --- a/packages/api/module/rebind.js +++ /dev/null @@ -1,21 +0,0 @@ -// 更换手机 - -module.exports = (query, request) => { - const data = { - captcha: query.captcha, - phone: query.phone, - oldcaptcha: query.oldcaptcha, - ctcode: query.ctcode || '86', - } - return request( - 'POST', - `https://music.163.com/api/user/replaceCellphone`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/recommend_resource.js b/packages/api/module/recommend_resource.js deleted file mode 100644 index 34650871..00000000 --- a/packages/api/module/recommend_resource.js +++ /dev/null @@ -1,15 +0,0 @@ -// 每日推荐歌单 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/discovery/recommend/resource`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/recommend_songs.js b/packages/api/module/recommend_songs.js deleted file mode 100644 index f83481e5..00000000 --- a/packages/api/module/recommend_songs.js +++ /dev/null @@ -1,17 +0,0 @@ -// 每日推荐歌曲 - -module.exports = (query, request) => { - query.cookie.os = 'ios' - const data = {} - return request( - 'POST', - `https://music.163.com/api/v3/discovery/recommend/songs`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/register_cellphone.js b/packages/api/module/register_cellphone.js deleted file mode 100644 index d03c51a8..00000000 --- a/packages/api/module/register_cellphone.js +++ /dev/null @@ -1,19 +0,0 @@ -// 注册账号 -const crypto = require('crypto') - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - captcha: query.captcha, - phone: query.phone, - password: crypto.createHash('md5').update(query.password).digest('hex'), - nickname: query.nickname, - countrycode: query.countrycode || '86', - } - return request('POST', `https://music.163.com/api/register/cellphone`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/related_allvideo.js b/packages/api/module/related_allvideo.js deleted file mode 100644 index e75a8c43..00000000 --- a/packages/api/module/related_allvideo.js +++ /dev/null @@ -1,19 +0,0 @@ -// 相关视频 - -module.exports = (query, request) => { - const data = { - id: query.id, - type: /^\d+$/.test(query.id) ? 0 : 1, - } - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/v1/allvideo/rcmd`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/related_playlist.js b/packages/api/module/related_playlist.js deleted file mode 100644 index 6f64b3d4..00000000 --- a/packages/api/module/related_playlist.js +++ /dev/null @@ -1,38 +0,0 @@ -// 相关歌单 - -module.exports = (query, request) => { - return request( - 'GET', - `https://music.163.com/playlist?id=${query.id}`, - {}, - { - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ).then((response) => { - try { - const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g - let result, - playlists = [] - while ((result = pattern.exec(response.body)) != null) { - playlists.push({ - creator: { - userId: result[4].slice('/user/home?id='.length), - nickname: result[5], - }, - coverImgUrl: result[1].slice(0, -'?param=50y50'.length), - name: result[3], - id: result[2].slice('/playlist?id='.length), - }) - } - response.body = { code: 200, playlists: playlists } - return response - } catch (err) { - response.status = 500 - response.body = { code: 500, msg: err.stack } - return Promise.reject(response) - } - }) -} diff --git a/packages/api/module/resource_like.js b/packages/api/module/resource_like.js deleted file mode 100644 index de285b6c..00000000 --- a/packages/api/module/resource_like.js +++ /dev/null @@ -1,29 +0,0 @@ -// 点赞与取消点赞资源 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - query.t = query.t == 1 ? 'like' : 'unlike' - query.type = { - 1: 'R_MV_5_', // MV - 4: 'A_DJ_1_', // 电台 - 5: 'R_VI_62_', // 视频 - 6: 'A_EV_2_', - }[query.type] - const data = { - threadId: query.type + query.id, - } - if (query.type === 'A_EV_2_') { - data.threadId = query.threadId - } - return request( - 'POST', - `https://music.163.com/weapi/resource/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/scrobble.js b/packages/api/module/scrobble.js deleted file mode 100644 index ad542d5f..00000000 --- a/packages/api/module/scrobble.js +++ /dev/null @@ -1,27 +0,0 @@ -// 听歌打卡 - -module.exports = (query, request) => { - const data = { - logs: JSON.stringify([ - { - action: 'play', - json: { - download: 0, - end: 'playend', - id: query.id, - sourceId: query.sourceid, - time: query.time, - type: 'song', - wifi: 0, - }, - }, - ]), - } - - return request('POST', `https://music.163.com/weapi/feedback/weblog`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/search.js b/packages/api/module/search.js deleted file mode 100644 index b2e1ff99..00000000 --- a/packages/api/module/search.js +++ /dev/null @@ -1,16 +0,0 @@ -// 搜索 - -module.exports = (query, request) => { - const data = { - s: query.keywords, - type: query.type || 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频 - limit: query.limit || 30, - offset: query.offset || 0, - } - return request('POST', `https://music.163.com/weapi/search/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/search_default.js b/packages/api/module/search_default.js deleted file mode 100644 index b5732541..00000000 --- a/packages/api/module/search_default.js +++ /dev/null @@ -1,16 +0,0 @@ -// 默认搜索关键词 - -module.exports = (query, request) => { - return request( - 'POST', - `https://interface3.music.163.com/eapi/search/defaultkeyword/get`, - {}, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/search/defaultkeyword/get', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/search_hot.js b/packages/api/module/search_hot.js deleted file mode 100644 index 75c95a6f..00000000 --- a/packages/api/module/search_hot.js +++ /dev/null @@ -1,14 +0,0 @@ -// 热门搜索 - -module.exports = (query, request) => { - const data = { - type: 1111, - } - return request('POST', `https://music.163.com/weapi/search/hot`, data, { - crypto: 'weapi', - ua: 'mobile', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/search_hot_detail.js b/packages/api/module/search_hot_detail.js deleted file mode 100644 index aae7c7e1..00000000 --- a/packages/api/module/search_hot_detail.js +++ /dev/null @@ -1,15 +0,0 @@ -// 热搜列表 -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/weapi/hotsearchlist/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/search_multimatch.js b/packages/api/module/search_multimatch.js deleted file mode 100644 index 6e4c0e8f..00000000 --- a/packages/api/module/search_multimatch.js +++ /dev/null @@ -1,19 +0,0 @@ -// 多类型搜索 - -module.exports = (query, request) => { - const data = { - type: query.type || 1, - s: query.keywords || '', - } - return request( - 'POST', - `https://music.163.com/weapi/search/suggest/multimatch`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/search_suggest.js b/packages/api/module/search_suggest.js deleted file mode 100644 index 943bcbc8..00000000 --- a/packages/api/module/search_suggest.js +++ /dev/null @@ -1,30 +0,0 @@ -// 搜索建议 -// 增加QQ音乐搜索结果,网易云版权太少了 -const { search } = require('@radishes/unblock/src/provider/qq') - -module.exports = (query, request) => { - const data = { - s: query.keywords || '', - } - let type = query.type == 'mobile' ? 'keyword' : 'web' - return request( - 'POST', - `https://music.163.com/weapi/search/suggest/` + type, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ).then(async (v) => { - const url = await search( - { - keyword: query.keywords, - }, - true, - ).catch(() => {}) - v.body.qq = url - return v - }) -} diff --git a/packages/api/module/send_album.js b/packages/api/module/send_album.js deleted file mode 100644 index 8af56733..00000000 --- a/packages/api/module/send_album.js +++ /dev/null @@ -1,18 +0,0 @@ -// 私信专辑 - -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - const data = { - id: query.id, - msg: query.msg || '', - type: 'album', - userIds: '[' + query.user_ids + ']', - } - return request('POST', `https://music.163.com/api/msg/private/send`, data, { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/send_playlist.js b/packages/api/module/send_playlist.js deleted file mode 100644 index a1d9bd46..00000000 --- a/packages/api/module/send_playlist.js +++ /dev/null @@ -1,17 +0,0 @@ -// 私信歌单 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - id: query.playlist, - type: 'playlist', - msg: query.msg, - userIds: '[' + query.user_ids + ']', - } - return request('POST', `https://music.163.com/weapi/msg/private/send`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/send_song.js b/packages/api/module/send_song.js deleted file mode 100644 index 932cde14..00000000 --- a/packages/api/module/send_song.js +++ /dev/null @@ -1,18 +0,0 @@ -// 私信歌曲 - -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - const data = { - id: query.id, - msg: query.msg || '', - type: 'song', - userIds: '[' + query.user_ids + ']', - } - return request('POST', `https://music.163.com/api/msg/private/send`, data, { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/send_text.js b/packages/api/module/send_text.js deleted file mode 100644 index a13ad350..00000000 --- a/packages/api/module/send_text.js +++ /dev/null @@ -1,16 +0,0 @@ -// 私信 - -module.exports = (query, request) => { - query.cookie.os = 'pc' - const data = { - type: 'text', - msg: query.msg, - userIds: '[' + query.user_ids + ']', - } - return request('POST', `https://music.163.com/weapi/msg/private/send`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/setting.js b/packages/api/module/setting.js deleted file mode 100644 index 7dd82791..00000000 --- a/packages/api/module/setting.js +++ /dev/null @@ -1,11 +0,0 @@ -// 设置 - -module.exports = (query, request) => { - const data = {} - return request('POST', `https://music.163.com/api/user/setting`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/share_resource.js b/packages/api/module/share_resource.js deleted file mode 100644 index 64c016a6..00000000 --- a/packages/api/module/share_resource.js +++ /dev/null @@ -1,20 +0,0 @@ -// 分享歌曲到动态 - -module.exports = (query, request) => { - const data = { - type: query.type || 'song', // song,playlist,mv,djprogram,djradio - msg: query.msg || '', - id: query.id || '', - } - return request( - 'POST', - `https://music.163.com/weapi/share/friends/resource`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/simi_artist.js b/packages/api/module/simi_artist.js deleted file mode 100644 index 36d25726..00000000 --- a/packages/api/module/simi_artist.js +++ /dev/null @@ -1,20 +0,0 @@ -// 相似歌手 -const config = require('../util/config.json') -module.exports = (query, request) => { - if (!('MUSIC_U' in query.cookie)) - query.cookie.MUSIC_A = config.anonymous_token - const data = { - artistid: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiArtist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/simi_mv.js b/packages/api/module/simi_mv.js deleted file mode 100644 index 6dd1c5f1..00000000 --- a/packages/api/module/simi_mv.js +++ /dev/null @@ -1,13 +0,0 @@ -// 相似MV - -module.exports = (query, request) => { - const data = { - mvid: query.mvid, - } - return request('POST', `https://music.163.com/weapi/discovery/simiMV`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/simi_playlist.js b/packages/api/module/simi_playlist.js deleted file mode 100644 index 11052df3..00000000 --- a/packages/api/module/simi_playlist.js +++ /dev/null @@ -1,20 +0,0 @@ -// 相似歌单 - -module.exports = (query, request) => { - const data = { - songid: query.id, - limit: query.limit || 50, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiPlaylist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/simi_song.js b/packages/api/module/simi_song.js deleted file mode 100644 index 58b3be9e..00000000 --- a/packages/api/module/simi_song.js +++ /dev/null @@ -1,20 +0,0 @@ -// 相似歌曲 - -module.exports = (query, request) => { - const data = { - songid: query.id, - limit: query.limit || 50, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/discovery/simiSong`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/simi_user.js b/packages/api/module/simi_user.js deleted file mode 100644 index 65a96d19..00000000 --- a/packages/api/module/simi_user.js +++ /dev/null @@ -1,20 +0,0 @@ -// 相似用户 - -module.exports = (query, request) => { - const data = { - songid: query.id, - limit: query.limit || 50, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiUser`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/song_detail.js b/packages/api/module/song_detail.js deleted file mode 100644 index 17ebe55e..00000000 --- a/packages/api/module/song_detail.js +++ /dev/null @@ -1,15 +0,0 @@ -// 歌曲详情 - -module.exports = (query, request) => { - query.ids = query.ids.split(/\s*,\s*/) - const data = { - c: '[' + query.ids.map(id => '{"id":' + id + '}').join(',') + ']', - ids: '[' + query.ids.join(',') + ']', - } - return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/song_order_update.js b/packages/api/module/song_order_update.js deleted file mode 100644 index 0dfb416c..00000000 --- a/packages/api/module/song_order_update.js +++ /dev/null @@ -1,22 +0,0 @@ -// 更新歌曲顺序 - -module.exports = (query, request) => { - const data = { - pid: query.pid, - trackIds: query.ids, - op: 'update', - } - - return request( - 'POST', - `http://interface.music.163.com/api/playlist/manipulate/tracks`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/desc/update', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/song_url.js b/packages/api/module/song_url.js deleted file mode 100644 index 4c3fc867..00000000 --- a/packages/api/module/song_url.js +++ /dev/null @@ -1,62 +0,0 @@ -// 歌曲链接 - -// 从 packages/unblock 中解析网易云音乐ID的播放链接,突破灰色歌曲限制 -const match = require('@radishes/unblock') -const crypto = require('crypto') - -const find = (id, source) => { - const playSource = - typeof source === 'string' - ? source.split(',') - : ['qq', 'baidu', 'kugou', 'kuwo'] - return match(id, playSource) - .then((url) => { - return url.url - }) - .catch((e) => { - console.warn(e) - return '' - }) -} - -module.exports = (query, request) => { - if (!('MUSIC_U' in query.cookie)) - query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex') - query.cookie.os = 'pc' - const data = { - ids: '[' + query.id + ']', - br: parseInt(query.br || 999000), - } - return request( - 'POST', - `https://interface3.music.163.com/eapi/song/enhance/player/url`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/song/enhance/player/url', - }, - ).then(async (v) => { - const { body } = v - if (Buffer.isBuffer(body)) { - v.body = JSON.parse(body.toString()) - } - - try { - let i = 0 - while (i < v.body.data.length) { - if (!v.body.data[i].url || v.body.data[i].freeTrialInfo) { - const url = await find(v.body.data[i].id, query.source) - v.body.data[i].url = url - } - i++ - } - } catch (e) { - console.log(e) - } - - return v - }) -} diff --git a/packages/api/module/top_album.js b/packages/api/module/top_album.js deleted file mode 100644 index d2202974..00000000 --- a/packages/api/module/top_album.js +++ /dev/null @@ -1,27 +0,0 @@ -// 新碟上架 - -module.exports = (query, request) => { - const date = new Date() - - const data = { - area: query.area || 'ALL', // //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本 - limit: query.limit || 50, - offset: query.offset || 0, - type: query.type || 'new', - year: query.year || date.getFullYear(), - month: query.month || date.getMonth() + 1, - total: false, - rcmd: true, - } - return request( - 'POST', - `https://music.163.com/api/discovery/new/albums/area`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/top_artists.js b/packages/api/module/top_artists.js deleted file mode 100644 index a1a40b60..00000000 --- a/packages/api/module/top_artists.js +++ /dev/null @@ -1,15 +0,0 @@ -// 热门歌手 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 50, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/weapi/artist/top`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/top_list.js b/packages/api/module/top_list.js deleted file mode 100644 index c33b251a..00000000 --- a/packages/api/module/top_list.js +++ /dev/null @@ -1,30 +0,0 @@ -// 排行榜 -module.exports = (query, request) => { - query.cookie.os = 'pc' - if (query.idx) { - return Promise.resolve({ - status: 500, - body: { - code: 500, - msg: '不支持此方式调用,只支持id调用', - }, - }) - } - - const data = { - id: query.id, - n: '500', - s: '0', - } - return request( - 'POST', - `https://interface3.music.163.com/api/playlist/v4/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/top_mv.js b/packages/api/module/top_mv.js deleted file mode 100644 index 2dc7c22e..00000000 --- a/packages/api/module/top_mv.js +++ /dev/null @@ -1,16 +0,0 @@ -// MV排行榜 - -module.exports = (query, request) => { - const data = { - area: query.area || '', - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/weapi/mv/toplist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/top_playlist.js b/packages/api/module/top_playlist.js deleted file mode 100644 index 4f41edb9..00000000 --- a/packages/api/module/top_playlist.js +++ /dev/null @@ -1,17 +0,0 @@ -// 分类歌单 - -module.exports = (query, request) => { - const data = { - cat: query.cat || '全部', // 全部,华语,欧美,日语,韩语,粤语,小语种,流行,摇滚,民谣,电子,舞曲,说唱,轻音乐,爵士,乡村,R&B/Soul,古典,民族,英伦,金属,朋克,蓝调,雷鬼,世界音乐,拉丁,另类/独立,New Age,古风,后摇,Bossa Nova,清晨,夜晚,学习,工作,午休,下午茶,地铁,驾车,运动,旅行,散步,酒吧,怀旧,清新,浪漫,性感,伤感,治愈,放松,孤独,感动,兴奋,快乐,安静,思念,影视原声,ACG,儿童,校园,游戏,70后,80后,90后,网络歌曲,KTV,经典,翻唱,吉他,钢琴,器乐,榜单,00后 - order: query.order || 'hot', // hot,new - limit: query.limit || 50, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/weapi/playlist/list`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/top_playlist_highquality.js b/packages/api/module/top_playlist_highquality.js deleted file mode 100644 index a704652e..00000000 --- a/packages/api/module/top_playlist_highquality.js +++ /dev/null @@ -1,21 +0,0 @@ -// 精品歌单 - -module.exports = (query, request) => { - const data = { - cat: query.cat || '全部', // 全部,华语,欧美,韩语,日语,粤语,小语种,运动,ACG,影视原声,流行,摇滚,后摇,古风,民谣,轻音乐,电子,器乐,说唱,古典,爵士 - limit: query.limit || 50, - lasttime: query.before || 0, // 歌单updateTime - total: true, - } - return request( - 'POST', - `https://music.163.com/api/playlist/highquality/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/top_song.js b/packages/api/module/top_song.js deleted file mode 100644 index 4b37d38d..00000000 --- a/packages/api/module/top_song.js +++ /dev/null @@ -1,21 +0,0 @@ -// 新歌速递 - -module.exports = (query, request) => { - const data = { - areaId: query.type || 0, // 全部:0 华语:7 欧美:96 日本:8 韩国:16 - // limit: query.limit || 100, - // offset: query.offset || 0, - total: true, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/discovery/new/songs`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/topic_detail.js b/packages/api/module/topic_detail.js deleted file mode 100644 index e0dd0062..00000000 --- a/packages/api/module/topic_detail.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = (query, request) => { - const data = { - actid: query.actid, - } - return request('POST', `https://music.163.com/api/act/detail`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/topic_detail_event_hot.js b/packages/api/module/topic_detail_event_hot.js deleted file mode 100644 index a979b6ff..00000000 --- a/packages/api/module/topic_detail_event_hot.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = (query, request) => { - const data = { - actid: query.actid, - } - return request('POST', `https://music.163.com/api/act/event/hot`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/topic_sublist.js b/packages/api/module/topic_sublist.js deleted file mode 100644 index 153b2985..00000000 --- a/packages/api/module/topic_sublist.js +++ /dev/null @@ -1,15 +0,0 @@ -// 收藏的专栏 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 50, - offset: query.offset || 0, - total: true, - } - return request('POST', `https://music.163.com/api/topic/sublist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/toplist.js b/packages/api/module/toplist.js deleted file mode 100644 index c690241b..00000000 --- a/packages/api/module/toplist.js +++ /dev/null @@ -1,15 +0,0 @@ -// 所有榜单介绍 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/toplist`, - {}, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/toplist_artist.js b/packages/api/module/toplist_artist.js deleted file mode 100644 index 825a6492..00000000 --- a/packages/api/module/toplist_artist.js +++ /dev/null @@ -1,16 +0,0 @@ -// 歌手榜 - -module.exports = (query, request) => { - const data = { - type: query.type || 1, - limit: 100, - offset: 0, - total: true, - } - return request('POST', `https://music.163.com/weapi/toplist/artist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/toplist_detail.js b/packages/api/module/toplist_detail.js deleted file mode 100644 index e194e03c..00000000 --- a/packages/api/module/toplist_detail.js +++ /dev/null @@ -1,15 +0,0 @@ -// 所有榜单内容摘要 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/toplist/detail`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_account.js b/packages/api/module/user_account.js deleted file mode 100644 index 0eff0024..00000000 --- a/packages/api/module/user_account.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request('POST', `https://music.163.com/api/nuser/account/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/user_audio.js b/packages/api/module/user_audio.js deleted file mode 100644 index b63e7009..00000000 --- a/packages/api/module/user_audio.js +++ /dev/null @@ -1,18 +0,0 @@ -// 用户创建的电台 - -module.exports = (query, request) => { - const data = { - userId: query.uid, - } - return request( - 'POST', - `https://music.163.com/weapi/djradio/get/byuser`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_binding.js b/packages/api/module/user_binding.js deleted file mode 100644 index 559b4b51..00000000 --- a/packages/api/module/user_binding.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/v1/user/bindings/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_bindingcellphone.js b/packages/api/module/user_bindingcellphone.js deleted file mode 100644 index abe1c988..00000000 --- a/packages/api/module/user_bindingcellphone.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = (query, request) => { - const data = { - phone: query.phone, - countrycode: query.countrycode || '86', - captcha: query.captcha, - password: query.password - ? crypto.createHash('md5').update(query.password).digest('hex') - : '', - } - return request( - 'POST', - `https://music.163.com/api/user/bindingCellphone`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_cloud.js b/packages/api/module/user_cloud.js deleted file mode 100644 index 31349603..00000000 --- a/packages/api/module/user_cloud.js +++ /dev/null @@ -1,14 +0,0 @@ -// 云盘数据 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - } - return request('POST', `https://music.163.com/api/v1/cloud/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/user_cloud_del.js b/packages/api/module/user_cloud_del.js deleted file mode 100644 index 7a5577bc..00000000 --- a/packages/api/module/user_cloud_del.js +++ /dev/null @@ -1,13 +0,0 @@ -// 云盘歌曲删除 - -module.exports = (query, request) => { - const data = { - songIds: [query.id], - } - return request('POST', `https://music.163.com/weapi/cloud/del`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/user_cloud_detail.js b/packages/api/module/user_cloud_detail.js deleted file mode 100644 index 45f1b5a1..00000000 --- a/packages/api/module/user_cloud_detail.js +++ /dev/null @@ -1,19 +0,0 @@ -// 云盘数据详情 - -module.exports = (query, request) => { - const id = query.id.replace(/\s/g, '').split(',') - const data = { - songIds: id, - } - return request( - 'POST', - `https://music.163.com/weapi/v1/cloud/get/byids`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_detail.js b/packages/api/module/user_detail.js deleted file mode 100644 index b3da3404..00000000 --- a/packages/api/module/user_detail.js +++ /dev/null @@ -1,15 +0,0 @@ -// 用户详情 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/user/detail/${query.uid}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_dj.js b/packages/api/module/user_dj.js deleted file mode 100644 index 45a6a3ae..00000000 --- a/packages/api/module/user_dj.js +++ /dev/null @@ -1,19 +0,0 @@ -// 用户电台节目 - -module.exports = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/dj/program/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_event.js b/packages/api/module/user_event.js deleted file mode 100644 index 0c642aed..00000000 --- a/packages/api/module/user_event.js +++ /dev/null @@ -1,23 +0,0 @@ -// 用户动态 - -module.exports = (query, request) => { - query.cookie.os = 'ios' - query.cookie.appver = '8.1.20' - const data = { - getcounts: true, - time: query.lasttime || -1, - limit: query.limit || 30, - total: false, - } - return request( - 'POST', - `https://music.163.com/api/event/get/${query.uid}`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_followeds.js b/packages/api/module/user_followeds.js deleted file mode 100644 index 678477a1..00000000 --- a/packages/api/module/user_followeds.js +++ /dev/null @@ -1,23 +0,0 @@ -// 关注TA的人(粉丝) - -module.exports = (query, request) => { - const data = { - userId: query.uid, - time: '0', - limit: query.limit || 30, - offset: query.offset || 0, - getcounts: 'true', - } - return request( - 'POST', - `https://music.163.com/eapi/user/getfolloweds/${query.uid}`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/user/getfolloweds', - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_follows.js b/packages/api/module/user_follows.js deleted file mode 100644 index cff742f4..00000000 --- a/packages/api/module/user_follows.js +++ /dev/null @@ -1,20 +0,0 @@ -// TA关注的人(关注) - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - order: true, - } - return request( - 'POST', - `https://music.163.com/weapi/user/getfollows/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_level.js b/packages/api/module/user_level.js deleted file mode 100644 index 107a45ff..00000000 --- a/packages/api/module/user_level.js +++ /dev/null @@ -1,11 +0,0 @@ -// 类别热门电台 - -module.exports = (query, request) => { - const data = {} - return request('POST', `https://music.163.com/weapi/user/level`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/user_playlist.js b/packages/api/module/user_playlist.js deleted file mode 100644 index 51a7c457..00000000 --- a/packages/api/module/user_playlist.js +++ /dev/null @@ -1,16 +0,0 @@ -// 用户歌单 - -module.exports = (query, request) => { - const data = { - uid: query.uid, - limit: query.limit || 30, - offset: query.offset || 0, - includeVideo: true, - } - return request('POST', `https://music.163.com/api/user/playlist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/user_record.js b/packages/api/module/user_record.js deleted file mode 100644 index 8f5f2cc0..00000000 --- a/packages/api/module/user_record.js +++ /dev/null @@ -1,14 +0,0 @@ -// 听歌排行 - -module.exports = (query, request) => { - const data = { - uid: query.uid, - type: query.type || 0, // 1: 最近一周, 0: 所有时间 - } - return request('POST', `https://music.163.com/weapi/v1/play/record`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/user_replacephone.js b/packages/api/module/user_replacephone.js deleted file mode 100644 index feed2fef..00000000 --- a/packages/api/module/user_replacephone.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = (query, request) => { - const data = { - phone: query.phone, - captcha: query.captcha, - oldcaptcha: query.oldcaptcha, - countrycode: query.countrycode || '86', - } - return request( - 'POST', - `https://music.163.com/api/user/replaceCellphone`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_subcount.js b/packages/api/module/user_subcount.js deleted file mode 100644 index cfa53ab8..00000000 --- a/packages/api/module/user_subcount.js +++ /dev/null @@ -1,15 +0,0 @@ -// 收藏计数 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/subcount`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/user_update.js b/packages/api/module/user_update.js deleted file mode 100644 index 96c7af1b..00000000 --- a/packages/api/module/user_update.js +++ /dev/null @@ -1,24 +0,0 @@ -// 编辑用户信息 - -module.exports = (query, request) => { - const data = { - avatarImgId: '0', - birthday: query.birthday, - city: query.city, - gender: query.gender, - nickname: query.nickname, - province: query.province, - signature: query.signature, - } - return request( - 'POST', - `https://music.163.com/weapi/user/profile/update`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_category_list.js b/packages/api/module/video_category_list.js deleted file mode 100644 index 88c13c74..00000000 --- a/packages/api/module/video_category_list.js +++ /dev/null @@ -1,20 +0,0 @@ -// 视频分类列表 - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - total: 'true', - limit: query.limit || 99, - } - return request( - 'POST', - `https://music.163.com/api/cloudvideo/category/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_detail.js b/packages/api/module/video_detail.js deleted file mode 100644 index 63507ae9..00000000 --- a/packages/api/module/video_detail.js +++ /dev/null @@ -1,18 +0,0 @@ -// 视频详情 - -module.exports = (query, request) => { - const data = { - id: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/v1/video/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_detail_info.js b/packages/api/module/video_detail_info.js deleted file mode 100644 index 4a163ae9..00000000 --- a/packages/api/module/video_detail_info.js +++ /dev/null @@ -1,19 +0,0 @@ -// 视频点赞转发评论数数据 - -module.exports = (query, request) => { - const data = { - threadid: `R_VI_62_${query.vid}`, - composeliked: true, - } - return request( - 'POST', - `https://music.163.com/api/comment/commentthread/info`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_group.js b/packages/api/module/video_group.js deleted file mode 100644 index 9c391299..00000000 --- a/packages/api/module/video_group.js +++ /dev/null @@ -1,21 +0,0 @@ -// 视频标签/分类下的视频 - -module.exports = (query, request) => { - const data = { - groupId: query.id, - offset: query.offset || 0, - need_preview_url: 'true', - total: true, - } - return request( - 'POST', - `https://music.163.com/api/videotimeline/videogroup/otherclient/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_group_list.js b/packages/api/module/video_group_list.js deleted file mode 100644 index 22acdc7f..00000000 --- a/packages/api/module/video_group_list.js +++ /dev/null @@ -1,16 +0,0 @@ -// 视频标签列表 - -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/cloudvideo/group/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_sub.js b/packages/api/module/video_sub.js deleted file mode 100644 index 562a7c22..00000000 --- a/packages/api/module/video_sub.js +++ /dev/null @@ -1,19 +0,0 @@ -// 收藏与取消收藏视频 - -module.exports = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub' - const data = { - id: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/video/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_timeline_all.js b/packages/api/module/video_timeline_all.js deleted file mode 100644 index b05a46c3..00000000 --- a/packages/api/module/video_timeline_all.js +++ /dev/null @@ -1,22 +0,0 @@ -// 全部视频列表 - -module.exports = (query, request) => { - const data = { - groupId: 0, - offset: query.offset || 0, - need_preview_url: 'true', - total: true, - } - // /api/videotimeline/otherclient/get - return request( - 'POST', - `https://music.163.com/api/videotimeline/otherclient/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/video_timeline_recommend.js b/packages/api/module/video_timeline_recommend.js deleted file mode 100644 index 1ca218ab..00000000 --- a/packages/api/module/video_timeline_recommend.js +++ /dev/null @@ -1,17 +0,0 @@ -// 推荐视频 - -module.exports = (query, request) => { - const data = { - offset: query.offset || 0, - filterLives: '[]', - withProgramInfo: 'true', - needUrl: '1', - resolution: '480', - } - return request('POST', `https://music.163.com/api/videotimeline/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/video_url.js b/packages/api/module/video_url.js deleted file mode 100644 index b564f8a2..00000000 --- a/packages/api/module/video_url.js +++ /dev/null @@ -1,19 +0,0 @@ -// 视频链接 - -module.exports = (query, request) => { - const data = { - ids: '["' + query.id + '"]', - resolution: query.res || 1080, - } - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/playurl`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/weblog.js b/packages/api/module/weblog.js deleted file mode 100644 index 1b593e34..00000000 --- a/packages/api/module/weblog.js +++ /dev/null @@ -1,15 +0,0 @@ -// 操作记录 - -module.exports = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/feedback/weblog`, - query.data || {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/yunbei.js b/packages/api/module/yunbei.js deleted file mode 100644 index b2bee9a3..00000000 --- a/packages/api/module/yunbei.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = (query, request) => { - const data = {} - // /api/point/today/get - return request('POST', `https://music.163.com/api/point/signed/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/yunbei_expense.js b/packages/api/module/yunbei_expense.js deleted file mode 100644 index 50b6f95d..00000000 --- a/packages/api/module/yunbei_expense.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = (query, request) => { - const data = { - limit: query.limit || 10, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/store/api/point/expense`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/yunbei_info.js b/packages/api/module/yunbei_info.js deleted file mode 100644 index 68ea2bf2..00000000 --- a/packages/api/module/yunbei_info.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request('POST', `https://music.163.com/api/v1/user/info`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/yunbei_receipt.js b/packages/api/module/yunbei_receipt.js deleted file mode 100644 index 5eb04ca1..00000000 --- a/packages/api/module/yunbei_receipt.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = (query, request) => { - const data = { - limit: query.limit || 10, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/store/api/point/receipt`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/yunbei_sign.js b/packages/api/module/yunbei_sign.js deleted file mode 100644 index 9765f6dc..00000000 --- a/packages/api/module/yunbei_sign.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = (query, request) => { - const data = { - type: '0', - } - return request('POST', `https://music.163.com/api/point/dailyTask`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/module/yunbei_task_finish.js b/packages/api/module/yunbei_task_finish.js deleted file mode 100644 index 0988ae9a..00000000 --- a/packages/api/module/yunbei_task_finish.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = (query, request) => { - const data = { - userTaskId: query.userTaskId, - depositCode: query.depositCode || '0', - } - return request( - 'POST', - `https://music.163.com/api/usertool/task/point/receive`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/yunbei_tasks.js b/packages/api/module/yunbei_tasks.js deleted file mode 100644 index fdc2d436..00000000 --- a/packages/api/module/yunbei_tasks.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/usertool/task/list/all`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/yunbei_tasks_todo.js b/packages/api/module/yunbei_tasks_todo.js deleted file mode 100644 index a2944847..00000000 --- a/packages/api/module/yunbei_tasks_todo.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/api/usertool/task/todo/query`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) -} diff --git a/packages/api/module/yunbei_today.js b/packages/api/module/yunbei_today.js deleted file mode 100644 index 5b542bf6..00000000 --- a/packages/api/module/yunbei_today.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = (query, request) => { - const data = {} - return request('POST', `https://music.163.com/api/point/today/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) -} diff --git a/packages/api/package.json b/packages/api/package.json deleted file mode 100644 index 0d9d5586..00000000 --- a/packages/api/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "@radishes/api", - "version": "4.0.9", - "description": "网易云音乐 NodeJS 版 API", - "scripts": { - "dev": "nodemon app.js", - "build": "pkg . && cpx \"dist/**/*\" \"../../public/service\"", - "start": "node app.js", - "test": "mocha -r intelli-espower-loader -t 20000 app.test.js --exit", - "lint": "eslint **/*.{js,ts}", - "lint-fix": "eslint --fix **/*.{js,ts}" - }, - "keywords": [ - "网易云音乐", - "网易云", - "音乐", - "网易云音乐nodejs" - ], - "main": "main.js", - "types": "./interface.d.ts", - "engines": { - "node": ">=12" - }, - "pkg": { - "scripts": "module/**/*.js", - "targets": [ - "node12.18.1-linux-x64", - "node12.18.1-win-x64", - "node12.18.1-macos-x64" - ], - "outputPath": "dist" - }, - "bin": "app.js", - "lint-staged": { - "*.js": [ - "eslint --fix", - "git add" - ] - }, - "author": "binaryify", - "license": "MIT", - "files": [ - "module", - "util", - "plugins", - "main.d.ts", - "interface.d.ts", - "module_types" - ], - "dependencies": { - "@radishes/unblock": "^2.0.1", - "axios": "^0.21.1", - "express": "^4.17.1", - "express-fileupload": "^1.1.9", - "js-base64": "^3.7.2", - "md5": "^2.3.0", - "music-metadata": "^7.5.3", - "nodemon": "^2.0.7", - "pac-proxy-agent": "^4.0.0", - "qrcode": "^1.4.4", - "tunnel": "^0.0.6" - }, - "devDependencies": { - "@types/node": "14.14.31", - "@typescript-eslint/eslint-plugin": "4.4.1", - "@typescript-eslint/parser": "4.4.1", - "cpx": "^1.5.0", - "eslint": "^8.54.0", - "eslint-config-prettier": "7.1.0", - "eslint-plugin-html": "6.1.1", - "eslint-plugin-prettier": "^5.0.1", - "intelli-espower-loader": "1.0.1", - "lint-staged": "10.5.4", - "mocha": "8.3.1", - "pkg": "^4.5.1", - "power-assert": "1.6.1", - "prettier": "^3.1.0", - "typescript": "4.2.3" - } -} diff --git a/packages/api/plugins/songUpload.js b/packages/api/plugins/songUpload.js deleted file mode 100644 index c5c85f30..00000000 --- a/packages/api/plugins/songUpload.js +++ /dev/null @@ -1,39 +0,0 @@ -const axios = require('axios') -module.exports = async (query, request) => { - // 获取key和token - const tokenRes = await request( - 'POST', - `https://music.163.com/weapi/nos/token/alloc`, - { - bucket: '', - ext: 'mp3', - filename: query.songFile.name.replace('.mp3', ''), - local: false, - nos_product: 3, - type: 'audio', - md5: query.songFile.md5, - }, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy }, - ) - - // 上传 - const objectKey = tokenRes.body.result.objectKey.replace('/', '%2F') - try { - await axios({ - method: 'post', - url: `http://45.127.129.8/ymusic/${objectKey}?offset=0&complete=true&version=1.0`, - headers: { - 'x-nos-token': tokenRes.body.result.token, - 'Content-MD5': query.songFile.md5, - 'Content-Type': 'audio/mpeg', - 'Content-Length': String(query.songFile.size), - }, - data: query.songFile.data, - }) - } catch (error) { - console.log('error', error.response) - } - return { - ...tokenRes, - } -} diff --git a/packages/api/plugins/upload.js b/packages/api/plugins/upload.js deleted file mode 100644 index cddb52bd..00000000 --- a/packages/api/plugins/upload.js +++ /dev/null @@ -1,48 +0,0 @@ -const axios = require('axios') -module.exports = async (query, request) => { - const data = { - bucket: 'yyimgs', - ext: 'jpg', - filename: query.imgFile.name, - local: false, - nos_product: 0, - return_body: `{"code":200,"size":"$(ObjectSize)"}`, - type: 'other', - } - // 获取key和token - const res = await request( - 'POST', - `https://music.163.com/weapi/nos/token/alloc`, - data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy }, - ) - // 上传图片 - const res2 = await axios({ - method: 'post', - url: `https://nosup-hz1.127.net/yyimgs/${res.body.result.objectKey}?offset=0&complete=true&version=1.0`, - headers: { - 'x-nos-token': res.body.result.token, - 'Content-Type': 'image/jpeg', - }, - data: query.imgFile.data, - }) - // 获取裁剪后图片的id - const imgSize = query.imgSize || 300 - const imgX = query.imgX || 0 - const imgY = query.imgY || 0 - const res3 = await request( - 'POST', - `https://music.163.com/upload/img/op?id=${res.body.result.docId}&op=${imgX}y${imgY}y${imgSize}y${imgSize}`, - {}, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy }, - ) - - return { - // ...res.body.result, - // ...res2.data, - // ...res3.body, - url_pre: 'https://p1.music.126.net/' + res.body.result.objectKey, - url: res3.body.url, - imgId: res3.body.id, - } -} diff --git a/packages/api/public/avatar_update.html b/packages/api/public/avatar_update.html deleted file mode 100644 index 7b0817f6..00000000 --- a/packages/api/public/avatar_update.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - 更新头像 - - - - - - - - - diff --git a/packages/api/public/cloud.html b/packages/api/public/cloud.html deleted file mode 100644 index 746b9b25..00000000 --- a/packages/api/public/cloud.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - 云盘上传 - - - - - - - - - - \ No newline at end of file diff --git a/packages/api/public/index.html b/packages/api/public/index.html deleted file mode 100644 index ff4c0fa7..00000000 --- a/packages/api/public/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - 网易云音乐 API - - - -

网易云音乐 API

- 当你看到这个页面时,这个服务已经成功跑起来了~ -
查看文档 -

例子:

- - - - - diff --git a/packages/api/public/playlist_cover_update.html b/packages/api/public/playlist_cover_update.html deleted file mode 100644 index 75e0fe6f..00000000 --- a/packages/api/public/playlist_cover_update.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - 歌单封面上传 - - - - - - - - - diff --git a/packages/api/public/qrlogin.html b/packages/api/public/qrlogin.html deleted file mode 100644 index a6beb3e2..00000000 --- a/packages/api/public/qrlogin.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - 二维码登录 - - - - -
- - - - - diff --git a/packages/api/public/test.html b/packages/api/public/test.html deleted file mode 100644 index fccca528..00000000 --- a/packages/api/public/test.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - test - - - -

请在控制台看结果

- - - - - - diff --git a/packages/api/renovate.json b/packages/api/renovate.json deleted file mode 100644 index f45d8f11..00000000 --- a/packages/api/renovate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "config:base" - ] -} diff --git a/packages/api/test/album.test.js b/packages/api/test/album.test.js deleted file mode 100644 index 2a6a1b9f..00000000 --- a/packages/api/test/album.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require('assert') -const axios = require('axios') -const host = global.host || 'http://localhost:3000' - -describe('测试获取歌手专辑列表是否正常', () => { - it('数据的 code 应该为200', (done) => { - const qs = { - id: 32311, - } - - axios - .get(`${host}/album`, { - params: qs, - }) - .then(({ status, data }) => { - if (status == 200) { - assert(data.code === 200) - } - done() - }) - .catch((err) => { - done(err) - }) - }) -}) diff --git a/packages/api/test/comment.test.js b/packages/api/test/comment.test.js deleted file mode 100644 index 612f6700..00000000 --- a/packages/api/test/comment.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require('assert') -const axios = require('axios') -const host = global.host || 'http://localhost:3000' - -describe('测试获取评论是否正常', () => { - it('数据的 code 应该为200', (done) => { - const qs = { - id: 32311, - } - - axios - .get(`${host}/comment/album`, { - params: qs, - }) - .then(({ status, data }) => { - if (status == 200) { - assert(data.code === 200) - } - done() - }) - .catch((err) => { - done(err) - }) - }) -}) diff --git a/packages/api/test/lyric.test.js b/packages/api/test/lyric.test.js deleted file mode 100644 index 41886e45..00000000 --- a/packages/api/test/lyric.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require('assert') -const axios = require('axios') -const host = global.host || 'http://localhost:3000' - -describe('测试获取歌词是否正常', () => { - it('数据应该有 lrc 字段', (done) => { - const qs = { - id: 347230, - } - - axios - .get(`${host}/lyric`, { - params: qs, - }) - .then(({ status, data }) => { - if (status == 200) { - assert(typeof data.lrc !== 'undefined') - } - done() - }) - .catch((err) => { - done(err) - }) - }) -}) diff --git a/packages/api/test/music_url.test.js b/packages/api/test/music_url.test.js deleted file mode 100644 index cf7777c2..00000000 --- a/packages/api/test/music_url.test.js +++ /dev/null @@ -1,26 +0,0 @@ -const assert = require('assert') -const axios = require('axios') -const host = global.host || 'http://localhost:3000' - -describe('测试获取歌曲是否正常', () => { - it('歌曲的 url 不应该为空', (done) => { - const qs = { - id: 462791935, - br: 999000, - } - - axios - .get(`${host}/song/url`, { - params: qs, - }) - .then(({ status, data }) => { - if (status == 200) { - assert(!!data.data[0].url) - } - done() - }) - .catch((err) => { - done(err) - }) - }) -}) diff --git a/packages/api/test/search.test.js b/packages/api/test/search.test.js deleted file mode 100644 index e80dea53..00000000 --- a/packages/api/test/search.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require('assert') -const axios = require('axios') -const host = global.host || 'http://localhost:3000' - -describe('测试搜索是否正常', () => { - it('获取到的数据的 name 应该和搜索关键词一致', (done) => { - const qs = { - keywords: '海阔天空', - type: 1, - } - axios - .get(`${host}/search`, { - params: qs, - }) - .then(({ status, data }) => { - if (status == 200) { - assert(data.result.songs[0].name === '海阔天空') - } - done() - }) - .catch((err) => { - done(err) - }) - }) -}) diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json deleted file mode 100644 index 9656c530..00000000 --- a/packages/api/tsconfig.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2015", - "module": "commonjs", - "experimentalDecorators": true, - "moduleResolution": "node", - "lib": [ - "esnext", - "esnext.asynciterable", - "dom" - ], - "esModuleInterop": true, - "allowJs": true, - "sourceMap": true, - "strict": true, - "noEmit": true, - "baseUrl": ".", - "paths": { - "~/*": [ - "./*" - ], - "@/*": [ - "./*" - ] - }, - }, - "exclude": [ - "node_modules" - ] - } \ No newline at end of file diff --git a/packages/api/util/apicache.js b/packages/api/util/apicache.js deleted file mode 100644 index a71c9987..00000000 --- a/packages/api/util/apicache.js +++ /dev/null @@ -1,830 +0,0 @@ -var url = require('url') -var MemoryCache = require('./memory-cache') - -var t = { - ms: 1, - second: 1000, - minute: 60000, - hour: 3600000, - day: 3600000 * 24, - week: 3600000 * 24 * 7, - month: 3600000 * 24 * 30, -} - -var instances = [] - -var matches = function (a) { - return function (b) { - return a === b - } -} - -var doesntMatch = function (a) { - return function (b) { - return !matches(a)(b) - } -} - -var logDuration = function (d, prefix) { - var str = d > 1000 ? (d / 1000).toFixed(2) + 'sec' : d + 'ms' - return '\x1b[33m- ' + (prefix ? prefix + ' ' : '') + str + '\x1b[0m' -} - -function getSafeHeaders(res) { - return res.getHeaders ? res.getHeaders() : res._headers -} - -function ApiCache() { - var memCache = new MemoryCache() - - var globalOptions = { - debug: false, - defaultDuration: 3600000, - enabled: true, - appendKey: [], - jsonp: false, - redisClient: false, - headerBlacklist: [], - statusCodes: { - include: [], - exclude: [], - }, - events: { - expire: undefined, - }, - headers: { - // 'cache-control': 'no-cache' // example of header overwrite - }, - trackPerformance: false, - } - - var middlewareOptions = [] - var instance = this - var index = null - var timers = {} - var performanceArray = [] // for tracking cache hit rate - - instances.push(this) - this.id = instances.length - - function debug(a, b, c, d) { - var arr = ['\x1b[36m[apicache]\x1b[0m', a, b, c, d].filter(function (arg) { - return arg !== undefined - }) - var debugEnv = - process.env.DEBUG && - process.env.DEBUG.split(',').indexOf('apicache') !== -1 - - return (globalOptions.debug || debugEnv) && console.log.apply(null, arr) - } - - function shouldCacheResponse(request, response, toggle) { - var opt = globalOptions - var codes = opt.statusCodes - - if (!response) return false - - if (toggle && !toggle(request, response)) { - return false - } - - if ( - codes.exclude && - codes.exclude.length && - codes.exclude.indexOf(response.statusCode) !== -1 - ) - return false - if ( - codes.include && - codes.include.length && - codes.include.indexOf(response.statusCode) === -1 - ) - return false - - return true - } - - function addIndexEntries(key, req) { - var groupName = req.apicacheGroup - - if (groupName) { - debug('group detected "' + groupName + '"') - var group = (index.groups[groupName] = index.groups[groupName] || []) - group.unshift(key) - } - - index.all.unshift(key) - } - - function filterBlacklistedHeaders(headers) { - return Object.keys(headers) - .filter(function (key) { - return globalOptions.headerBlacklist.indexOf(key) === -1 - }) - .reduce(function (acc, header) { - acc[header] = headers[header] - return acc - }, {}) - } - - function createCacheObject(status, headers, data, encoding) { - return { - status: status, - headers: filterBlacklistedHeaders(headers), - data: data, - encoding: encoding, - timestamp: new Date().getTime() / 1000, // seconds since epoch. This is used to properly decrement max-age headers in cached responses. - } - } - - function cacheResponse(key, value, duration) { - var redis = globalOptions.redisClient - var expireCallback = globalOptions.events.expire - - if (redis && redis.connected) { - try { - redis.hset(key, 'response', JSON.stringify(value)) - redis.hset(key, 'duration', duration) - redis.expire(key, duration / 1000, expireCallback || function () {}) - } catch (err) { - debug('[apicache] error in redis.hset()') - } - } else { - memCache.add(key, value, duration, expireCallback) - } - - // add automatic cache clearing from duration, includes max limit on setTimeout - timers[key] = setTimeout(function () { - instance.clear(key, true) - }, Math.min(duration, 2147483647)) - } - - function accumulateContent(res, content) { - if (content) { - if (typeof content == 'string') { - res._apicache.content = (res._apicache.content || '') + content - } else if (Buffer.isBuffer(content)) { - var oldContent = res._apicache.content - - if (typeof oldContent === 'string') { - oldContent = !Buffer.from - ? new Buffer(oldContent) - : Buffer.from(oldContent) - } - - if (!oldContent) { - oldContent = !Buffer.alloc ? new Buffer(0) : Buffer.alloc(0) - } - - res._apicache.content = Buffer.concat( - [oldContent, content], - oldContent.length + content.length, - ) - } else { - res._apicache.content = content - } - } - } - - function makeResponseCacheable( - req, - res, - next, - key, - duration, - strDuration, - toggle, - ) { - // monkeypatch res.end to create cache object - res._apicache = { - write: res.write, - writeHead: res.writeHead, - end: res.end, - cacheable: true, - content: undefined, - } - - // append header overwrites if applicable - Object.keys(globalOptions.headers).forEach(function (name) { - res.setHeader(name, globalOptions.headers[name]) - }) - - res.writeHead = function () { - // add cache control headers - if (!globalOptions.headers['cache-control']) { - if (shouldCacheResponse(req, res, toggle)) { - res.setHeader( - 'cache-control', - 'max-age=' + (duration / 1000).toFixed(0), - ) - } else { - res.setHeader('cache-control', 'no-cache, no-store, must-revalidate') - } - } - - res._apicache.headers = Object.assign({}, getSafeHeaders(res)) - return res._apicache.writeHead.apply(this, arguments) - } - - // patch res.write - res.write = function (content) { - accumulateContent(res, content) - return res._apicache.write.apply(this, arguments) - } - - // patch res.end - res.end = function (content, encoding) { - if (shouldCacheResponse(req, res, toggle)) { - accumulateContent(res, content) - - if (res._apicache.cacheable && res._apicache.content) { - addIndexEntries(key, req) - var headers = res._apicache.headers || getSafeHeaders(res) - var cacheObject = createCacheObject( - res.statusCode, - headers, - res._apicache.content, - encoding, - ) - cacheResponse(key, cacheObject, duration) - - // display log entry - var elapsed = new Date() - req.apicacheTimer - debug( - 'adding cache entry for "' + key + '" @ ' + strDuration, - logDuration(elapsed), - ) - debug('_apicache.headers: ', res._apicache.headers) - debug('res.getHeaders(): ', getSafeHeaders(res)) - debug('cacheObject: ', cacheObject) - } - } - - return res._apicache.end.apply(this, arguments) - } - - next() - } - - function sendCachedResponse( - request, - response, - cacheObject, - toggle, - next, - duration, - ) { - if (toggle && !toggle(request, response)) { - return next() - } - - var headers = getSafeHeaders(response) - - Object.assign( - headers, - filterBlacklistedHeaders(cacheObject.headers || {}), - { - // set properly-decremented max-age header. This ensures that max-age is in sync with the cache expiration. - 'cache-control': - 'max-age=' + - Math.max( - 0, - ( - duration / 1000 - - (new Date().getTime() / 1000 - cacheObject.timestamp) - ).toFixed(0), - ), - }, - ) - - // only embed apicache headers when not in production environment - - // unstringify buffers - var data = cacheObject.data - if (data && data.type === 'Buffer') { - data = - typeof data.data === 'number' - ? new Buffer.alloc(data.data) - : new Buffer.from(data.data) - } - - // test Etag against If-None-Match for 304 - var cachedEtag = cacheObject.headers.etag - var requestEtag = request.headers['if-none-match'] - - if (requestEtag && cachedEtag === requestEtag) { - response.writeHead(304, headers) - return response.end() - } - - response.writeHead(cacheObject.status || 200, headers) - - return response.end(data, cacheObject.encoding) - } - - function syncOptions() { - for (var i in middlewareOptions) { - Object.assign( - middlewareOptions[i].options, - globalOptions, - middlewareOptions[i].localOptions, - ) - } - } - - this.clear = function (target, isAutomatic) { - var group = index.groups[target] - var redis = globalOptions.redisClient - - if (group) { - debug('clearing group "' + target + '"') - - group.forEach(function (key) { - debug('clearing cached entry for "' + key + '"') - clearTimeout(timers[key]) - delete timers[key] - if (!globalOptions.redisClient) { - memCache.delete(key) - } else { - try { - redis.del(key) - } catch (err) { - console.log('[apicache] error in redis.del("' + key + '")') - } - } - index.all = index.all.filter(doesntMatch(key)) - }) - - delete index.groups[target] - } else if (target) { - debug( - 'clearing ' + - (isAutomatic ? 'expired' : 'cached') + - ' entry for "' + - target + - '"', - ) - clearTimeout(timers[target]) - delete timers[target] - // clear actual cached entry - if (!redis) { - memCache.delete(target) - } else { - try { - redis.del(target) - } catch (err) { - console.log('[apicache] error in redis.del("' + target + '")') - } - } - - // remove from global index - index.all = index.all.filter(doesntMatch(target)) - - // remove target from each group that it may exist in - Object.keys(index.groups).forEach(function (groupName) { - index.groups[groupName] = index.groups[groupName].filter( - doesntMatch(target), - ) - - // delete group if now empty - if (!index.groups[groupName].length) { - delete index.groups[groupName] - } - }) - } else { - debug('clearing entire index') - - if (!redis) { - memCache.clear() - } else { - // clear redis keys one by one from internal index to prevent clearing non-apicache entries - index.all.forEach(function (key) { - clearTimeout(timers[key]) - delete timers[key] - try { - redis.del(key) - } catch (err) { - console.log('[apicache] error in redis.del("' + key + '")') - } - }) - } - this.resetIndex() - } - - return this.getIndex() - } - - function parseDuration(duration, defaultDuration) { - if (typeof duration === 'number') return duration - - if (typeof duration === 'string') { - var split = duration.match(/^([\d\.,]+)\s?(\w+)$/) - - if (split.length === 3) { - var len = parseFloat(split[1]) - var unit = split[2].replace(/s$/i, '').toLowerCase() - if (unit === 'm') { - unit = 'ms' - } - - return (len || 1) * (t[unit] || 0) - } - } - - return defaultDuration - } - - this.getDuration = function (duration) { - return parseDuration(duration, globalOptions.defaultDuration) - } - - /** - * Return cache performance statistics (hit rate). Suitable for putting into a route: - * - * app.get('/api/cache/performance', (req, res) => { - * res.json(apicache.getPerformance()) - * }) - * - */ - this.getPerformance = function () { - return performanceArray.map(function (p) { - return p.report() - }) - } - - this.getIndex = function (group) { - if (group) { - return index.groups[group] - } else { - return index - } - } - - this.middleware = function cache( - strDuration, - middlewareToggle, - localOptions, - ) { - var duration = instance.getDuration(strDuration) - var opt = {} - - middlewareOptions.push({ - options: opt, - }) - - var options = function (localOptions) { - if (localOptions) { - middlewareOptions.find(function (middleware) { - return middleware.options === opt - }).localOptions = localOptions - } - - syncOptions() - - return opt - } - - options(localOptions) - - /** - * A Function for non tracking performance - */ - function NOOPCachePerformance() { - this.report = this.hit = this.miss = function () {} // noop; - } - - /** - * A function for tracking and reporting hit rate. These statistics are returned by the getPerformance() call above. - */ - function CachePerformance() { - /** - * Tracks the hit rate for the last 100 requests. - * If there have been fewer than 100 requests, the hit rate just considers the requests that have happened. - */ - this.hitsLast100 = new Uint8Array(100 / 4) // each hit is 2 bits - - /** - * Tracks the hit rate for the last 1000 requests. - * If there have been fewer than 1000 requests, the hit rate just considers the requests that have happened. - */ - this.hitsLast1000 = new Uint8Array(1000 / 4) // each hit is 2 bits - - /** - * Tracks the hit rate for the last 10000 requests. - * If there have been fewer than 10000 requests, the hit rate just considers the requests that have happened. - */ - this.hitsLast10000 = new Uint8Array(10000 / 4) // each hit is 2 bits - - /** - * Tracks the hit rate for the last 100000 requests. - * If there have been fewer than 100000 requests, the hit rate just considers the requests that have happened. - */ - this.hitsLast100000 = new Uint8Array(100000 / 4) // each hit is 2 bits - - /** - * The number of calls that have passed through the middleware since the server started. - */ - this.callCount = 0 - - /** - * The total number of hits since the server started - */ - this.hitCount = 0 - - /** - * The key from the last cache hit. This is useful in identifying which route these statistics apply to. - */ - this.lastCacheHit = null - - /** - * The key from the last cache miss. This is useful in identifying which route these statistics apply to. - */ - this.lastCacheMiss = null - - /** - * Return performance statistics - */ - this.report = function () { - return { - lastCacheHit: this.lastCacheHit, - lastCacheMiss: this.lastCacheMiss, - callCount: this.callCount, - hitCount: this.hitCount, - missCount: this.callCount - this.hitCount, - hitRate: this.callCount == 0 ? null : this.hitCount / this.callCount, - hitRateLast100: this.hitRate(this.hitsLast100), - hitRateLast1000: this.hitRate(this.hitsLast1000), - hitRateLast10000: this.hitRate(this.hitsLast10000), - hitRateLast100000: this.hitRate(this.hitsLast100000), - } - } - - /** - * Computes a cache hit rate from an array of hits and misses. - * @param {Uint8Array} array An array representing hits and misses. - * @returns a number between 0 and 1, or null if the array has no hits or misses - */ - this.hitRate = function (array) { - var hits = 0 - var misses = 0 - for (var i = 0; i < array.length; i++) { - var n8 = array[i] - for (j = 0; j < 4; j++) { - switch (n8 & 3) { - case 1: - hits++ - break - case 2: - misses++ - break - } - n8 >>= 2 - } - } - var total = hits + misses - if (total == 0) return null - return hits / total - } - - /** - * Record a hit or miss in the given array. It will be recorded at a position determined - * by the current value of the callCount variable. - * @param {Uint8Array} array An array representing hits and misses. - * @param {boolean} hit true for a hit, false for a miss - * Each element in the array is 8 bits, and encodes 4 hit/miss records. - * Each hit or miss is encoded as to bits as follows: - * 00 means no hit or miss has been recorded in these bits - * 01 encodes a hit - * 10 encodes a miss - */ - this.recordHitInArray = function (array, hit) { - var arrayIndex = ~~(this.callCount / 4) % array.length - var bitOffset = (this.callCount % 4) * 2 // 2 bits per record, 4 records per uint8 array element - var clearMask = ~(3 << bitOffset) - var record = (hit ? 1 : 2) << bitOffset - array[arrayIndex] = (array[arrayIndex] & clearMask) | record - } - - /** - * Records the hit or miss in the tracking arrays and increments the call count. - * @param {boolean} hit true records a hit, false records a miss - */ - this.recordHit = function (hit) { - this.recordHitInArray(this.hitsLast100, hit) - this.recordHitInArray(this.hitsLast1000, hit) - this.recordHitInArray(this.hitsLast10000, hit) - this.recordHitInArray(this.hitsLast100000, hit) - if (hit) this.hitCount++ - this.callCount++ - } - - /** - * Records a hit event, setting lastCacheMiss to the given key - * @param {string} key The key that had the cache hit - */ - this.hit = function (key) { - this.recordHit(true) - this.lastCacheHit = key - } - - /** - * Records a miss event, setting lastCacheMiss to the given key - * @param {string} key The key that had the cache miss - */ - this.miss = function (key) { - this.recordHit(false) - this.lastCacheMiss = key - } - } - - var perf = globalOptions.trackPerformance - ? new CachePerformance() - : new NOOPCachePerformance() - - performanceArray.push(perf) - - var cache = function (req, res, next) { - function bypass() { - debug('bypass detected, skipping cache.') - return next() - } - - // initial bypass chances - if (!opt.enabled) return bypass() - if ( - req.headers['x-apicache-bypass'] || - req.headers['x-apicache-force-fetch'] - ) - return bypass() - - // REMOVED IN 0.11.1 TO CORRECT MIDDLEWARE TOGGLE EXECUTE ORDER - // if (typeof middlewareToggle === 'function') { - // if (!middlewareToggle(req, res)) return bypass() - // } else if (middlewareToggle !== undefined && !middlewareToggle) { - // return bypass() - // } - - // embed timer - req.apicacheTimer = new Date() - - // In Express 4.x the url is ambigious based on where a router is mounted. originalUrl will give the full Url - var key = req.originalUrl || req.url - - // Remove querystring from key if jsonp option is enabled - if (opt.jsonp) { - key = url.parse(key).pathname - } - - // add appendKey (either custom function or response path) - if (typeof opt.appendKey === 'function') { - key += '$$appendKey=' + opt.appendKey(req, res) - } else if (opt.appendKey.length > 0) { - var appendKey = req - - for (var i = 0; i < opt.appendKey.length; i++) { - appendKey = appendKey[opt.appendKey[i]] - } - key += '$$appendKey=' + appendKey - } - - // attempt cache hit - var redis = opt.redisClient - var cached = !redis ? memCache.getValue(key) : null - - // send if cache hit from memory-cache - if (cached) { - var elapsed = new Date() - req.apicacheTimer - debug( - 'sending cached (memory-cache) version of', - key, - logDuration(elapsed), - ) - - perf.hit(key) - return sendCachedResponse( - req, - res, - cached, - middlewareToggle, - next, - duration, - ) - } - - // send if cache hit from redis - if (redis && redis.connected) { - try { - redis.hgetall(key, function (err, obj) { - if (!err && obj && obj.response) { - var elapsed = new Date() - req.apicacheTimer - debug( - 'sending cached (redis) version of', - key, - logDuration(elapsed), - ) - - perf.hit(key) - return sendCachedResponse( - req, - res, - JSON.parse(obj.response), - middlewareToggle, - next, - duration, - ) - } else { - perf.miss(key) - return makeResponseCacheable( - req, - res, - next, - key, - duration, - strDuration, - middlewareToggle, - ) - } - }) - } catch (err) { - // bypass redis on error - perf.miss(key) - return makeResponseCacheable( - req, - res, - next, - key, - duration, - strDuration, - middlewareToggle, - ) - } - } else { - perf.miss(key) - return makeResponseCacheable( - req, - res, - next, - key, - duration, - strDuration, - middlewareToggle, - ) - } - } - - cache.options = options - - return cache - } - - this.options = function (options) { - if (options) { - Object.assign(globalOptions, options) - syncOptions() - - if ('defaultDuration' in options) { - // Convert the default duration to a number in milliseconds (if needed) - globalOptions.defaultDuration = parseDuration( - globalOptions.defaultDuration, - 3600000, - ) - } - - if (globalOptions.trackPerformance) { - debug( - 'WARNING: using trackPerformance flag can cause high memory usage!', - ) - } - - return this - } else { - return globalOptions - } - } - - this.resetIndex = function () { - index = { - all: [], - groups: {}, - } - } - - this.newInstance = function (config) { - var instance = new ApiCache() - - if (config) { - instance.options(config) - } - - return instance - } - - this.clone = function () { - return this.newInstance(this.options()) - } - - // initialize index - this.resetIndex() -} - -module.exports = new ApiCache() diff --git a/packages/api/util/config.json b/packages/api/util/config.json deleted file mode 100644 index dbfda367..00000000 --- a/packages/api/util/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "anonymous_token": "8aae43f148f990410b9a2af38324af24e87ab9227c9265627ddd10145db744295fcd8701dc45b1ab8985e142f491516295dd965bae848761274a577a62b0fdc54a50284d1e434dcc04ca6d1a52333c9a", - "resourceTypeMap": { - "0": "R_SO_4_", - "1": "R_MV_5_", - "2": "A_PL_0_", - "3": "R_AL_3_", - "4": "A_DJ_1_", - "5": "R_VI_62_", - "6": "A_EV_2_" - } -} diff --git a/packages/api/util/crypto.js b/packages/api/util/crypto.js deleted file mode 100644 index 3f99e858..00000000 --- a/packages/api/util/crypto.js +++ /dev/null @@ -1,67 +0,0 @@ -const crypto = require('crypto') -const iv = Buffer.from('0102030405060708') -const presetKey = Buffer.from('0CoJUm6Qyw8W8jud') -const linuxapiKey = Buffer.from('rFgB&h#%2?^eDg:Q') -const base62 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' -const publicKey = - '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDgtQn2JZ34ZC28NWYpAUd98iZ37BUrX/aKzmFbt7clFSs6sXqHauqKWqdtLkF2KexO40H1YTX8z2lSgBBOAxLsvaklV8k4cBFK9snQXE9/DDaFt6Rr7iVZMldczhC0JNgTz+SHXT6CBHuX3e9SdB1Ua44oncaTWz7OBGLbCiK45wIDAQAB\n-----END PUBLIC KEY-----' -const eapiKey = 'e82ckenh8dichen8' - -const aesEncrypt = (buffer, mode, key, iv) => { - const cipher = crypto.createCipheriv('aes-128-' + mode, key, iv) - return Buffer.concat([cipher.update(buffer), cipher.final()]) -} - -const rsaEncrypt = (buffer, key) => { - buffer = Buffer.concat([Buffer.alloc(128 - buffer.length), buffer]) - return crypto.publicEncrypt( - { key: key, padding: crypto.constants.RSA_NO_PADDING }, - buffer, - ) -} - -const weapi = (object) => { - const text = JSON.stringify(object) - const secretKey = crypto - .randomBytes(16) - .map((n) => base62.charAt(n % 62).charCodeAt()) - return { - params: aesEncrypt( - Buffer.from( - aesEncrypt(Buffer.from(text), 'cbc', presetKey, iv).toString('base64'), - ), - 'cbc', - secretKey, - iv, - ).toString('base64'), - encSecKey: rsaEncrypt(secretKey.reverse(), publicKey).toString('hex'), - } -} - -const linuxapi = (object) => { - const text = JSON.stringify(object) - return { - eparams: aesEncrypt(Buffer.from(text), 'ecb', linuxapiKey, '') - .toString('hex') - .toUpperCase(), - } -} - -const eapi = (url, object) => { - const text = typeof object === 'object' ? JSON.stringify(object) : object - const message = `nobody${url}use${text}md5forencrypt` - const digest = crypto.createHash('md5').update(message).digest('hex') - const data = `${url}-36cd479b6b5-${text}-36cd479b6b5-${digest}` - return { - params: aesEncrypt(Buffer.from(data), 'ecb', eapiKey, '') - .toString('hex') - .toUpperCase(), - } -} - -const decrypt = (cipherBuffer) => { - const decipher = crypto.createDecipheriv('aes-128-ecb', eapiKey, '') - return Buffer.concat([decipher.update(cipherBuffer), decipher.final()]) -} - -module.exports = { weapi, linuxapi, eapi, decrypt } diff --git a/packages/api/util/index.js b/packages/api/util/index.js deleted file mode 100644 index 06aade52..00000000 --- a/packages/api/util/index.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - toBoolean(val) { - if (typeof val === 'boolean') return val - if (val === '') return val - return val === 'true' || val == '1' - }, - cookieToJson(cookie) { - if (!cookie) return {} - let cookieArr = cookie.split(';') - let obj = {} - cookieArr.forEach((i) => { - let arr = i.split('=') - obj[arr[0]] = arr[1] - }) - return obj - }, -} diff --git a/packages/api/util/memory-cache.js b/packages/api/util/memory-cache.js deleted file mode 100644 index 6b6deaa2..00000000 --- a/packages/api/util/memory-cache.js +++ /dev/null @@ -1,63 +0,0 @@ -function MemoryCache() { - this.cache = {} - this.size = 0 -} - -MemoryCache.prototype.add = function (key, value, time, timeoutCallback) { - var old = this.cache[key] - var instance = this - - var entry = { - value: value, - expire: time + Date.now(), - timeout: setTimeout(function () { - instance.delete(key) - return ( - timeoutCallback && - typeof timeoutCallback === 'function' && - timeoutCallback(value, key) - ) - }, time), - } - - this.cache[key] = entry - this.size = Object.keys(this.cache).length - - return entry -} - -MemoryCache.prototype.delete = function (key) { - var entry = this.cache[key] - - if (entry) { - clearTimeout(entry.timeout) - } - - delete this.cache[key] - - this.size = Object.keys(this.cache).length - - return null -} - -MemoryCache.prototype.get = function (key) { - var entry = this.cache[key] - - return entry -} - -MemoryCache.prototype.getValue = function (key) { - var entry = this.get(key) - - return entry && entry.value -} - -MemoryCache.prototype.clear = function () { - Object.keys(this.cache).forEach(function (key) { - this.delete(key) - }, this) - - return true -} - -module.exports = MemoryCache diff --git a/packages/api/util/request.js b/packages/api/util/request.js deleted file mode 100644 index b15d694b..00000000 --- a/packages/api/util/request.js +++ /dev/null @@ -1,192 +0,0 @@ -const encrypt = require('./crypto') -const axios = require('axios') -const queryString = require('querystring') -const PacProxyAgent = require('pac-proxy-agent') -const http = require('http') -const https = require('https') -const tunnel = require('tunnel') -const qs = require('url') -// request.debug = true // 开启可看到更详细信息 - -const chooseUserAgent = (ua = false) => { - const userAgentList = { - mobile: [ - // iOS 13.5.1 14.0 beta with safari - 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1', - 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.', - // iOS with qq micromsg - 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML like Gecko) Mobile/14A456 QQ/6.5.7.408 V1_IPH_SQ_6.5.7_1_APP_A Pixel/750 Core/UIWebView NetType/4G Mem/103', - 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.15(0x17000f27) NetType/WIFI Language/zh', - // Android -> Huawei Xiaomi - 'Mozilla/5.0 (Linux; Android 9; PCT-AL10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.64 HuaweiBrowser/10.0.3.311 Mobile Safari/537.36', - 'Mozilla/5.0 (Linux; U; Android 9; zh-cn; Redmi Note 8 Build/PKQ1.190616.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.5.22', - // Android + qq micromsg - 'Mozilla/5.0 (Linux; Android 10; YAL-AL00 Build/HUAWEIYAL-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2581 MMWEBSDK/200801 Mobile Safari/537.36 MMWEBID/3027 MicroMessenger/7.0.18.1740(0x27001235) Process/toolsmp WeChat/arm64 NetType/WIFI Language/zh_CN ABI/arm64', - 'Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BKK-AL10 Build/HONORBKK-AL10) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/10.6 Mobile Safari/537.36', - ], - pc: [ - // macOS 10.15.6 Firefox / Chrome / Safari - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:80.0) Gecko/20100101 Firefox/80.0', - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.30 Safari/537.36', - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15', - // Windows 10 Firefox / Chrome / Edge - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0', - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.30 Safari/537.36', - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/13.10586', - // Linux 就算了 - ], - } - let realUserAgentList = - userAgentList[ua] || userAgentList.mobile.concat(userAgentList.pc) - return ['mobile', 'pc', false].indexOf(ua) > -1 - ? realUserAgentList[Math.floor(Math.random() * realUserAgentList.length)] - : ua -} -const createRequest = (method, url, data, options) => { - return new Promise((resolve, reject) => { - let headers = { 'User-Agent': chooseUserAgent(options.ua) } - if (method.toUpperCase() === 'POST') - headers['Content-Type'] = 'application/x-www-form-urlencoded' - if (url.includes('music.163.com')) - headers['Referer'] = 'https://music.163.com' - if (options.realIP) headers['X-Real-IP'] = options.realIP - // headers['X-Real-IP'] = '118.88.88.88' - if (typeof options.cookie === 'object') - headers['Cookie'] = Object.keys(options.cookie) - .map( - (key) => - encodeURIComponent(key) + - '=' + - encodeURIComponent(options.cookie[key]), - ) - .join('; ') - else if (options.cookie) headers['Cookie'] = options.cookie - - if (!headers['Cookie']) { - headers['Cookie'] = options.token || '' - } - if (options.crypto === 'weapi') { - let csrfToken = (headers['Cookie'] || '').match(/_csrf=([^(;|$)]+)/) - data.csrf_token = csrfToken ? csrfToken[1] : '' - data = encrypt.weapi(data) - url = url.replace(/\w*api/, 'weapi') - } else if (options.crypto === 'linuxapi') { - data = encrypt.linuxapi({ - method: method, - url: url.replace(/\w*api/, 'api'), - params: data, - }) - headers['User-Agent'] = - 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36' - url = 'https://music.163.com/api/linux/forward' - } else if (options.crypto === 'eapi') { - const cookie = options.cookie || {} - const csrfToken = cookie['__csrf'] || '' - const header = { - osver: cookie.osver, //系统版本 - deviceId: cookie.deviceId, //encrypt.base64.encode(imei + '\t02:00:00:00:00:00\t5106025eb79a5247\t70ffbaac7') - appver: cookie.appver || '8.0.0', // app版本 - versioncode: cookie.versioncode || '140', //版本号 - mobilename: cookie.mobilename, //设备model - buildver: cookie.buildver || Date.now().toString().substr(0, 10), - resolution: cookie.resolution || '1920x1080', //设备分辨率 - __csrf: csrfToken, - os: cookie.os || 'android', - channel: cookie.channel, - requestId: `${Date.now()}_${Math.floor(Math.random() * 1000) - .toString() - .padStart(4, '0')}`, - } - if (cookie.MUSIC_U) header['MUSIC_U'] = cookie.MUSIC_U - if (cookie.MUSIC_A) header['MUSIC_A'] = cookie.MUSIC_A - headers['Cookie'] = Object.keys(header) - .map( - (key) => - encodeURIComponent(key) + '=' + encodeURIComponent(header[key]), - ) - .join('; ') - data.header = header - data = encrypt.eapi(options.url, data) - url = url.replace(/\w*api/, 'eapi') - } - - const answer = { status: 500, body: {}, cookie: [] } - let settings = { - method: method, - url: url, - headers: headers, - data: queryString.stringify(data), - httpAgent: new http.Agent({ keepAlive: true }), - httpsAgent: new https.Agent({ keepAlive: true }), - } - - if (options.crypto === 'eapi') settings.encoding = null - - if (options.proxy) { - if (options.proxy.indexOf('pac') > -1) { - settings.httpAgent = new PacProxyAgent(options.proxy) - settings.httpsAgent = new PacProxyAgent(options.proxy) - } else { - var purl = qs.parse(options.proxy) - if (purl.hostname) { - const agent = tunnel.httpsOverHttp({ - proxy: { - host: purl.hostname, - port: purl.port || 80, - }, - }) - settings.httpsAgent = agent - settings.httpAgent = agent - settings.proxy = false - } else { - console.error('代理配置无效,不使用代理') - } - } - } - if (options.crypto === 'eapi') { - settings = { - ...settings, - responseType: 'arraybuffer', - } - } - axios(settings) - .then((res) => { - const body = res.data - answer.cookie = (res.headers['set-cookie'] || []).map((x) => - x.replace(/\s*Domain=[^(;|$)]+;*/, ''), - ) - try { - if (options.crypto === 'eapi') { - answer.body = JSON.parse(encrypt.decrypt(body).toString()) - } else { - answer.body = body - } - - answer.status = answer.body.code || res.status - if ( - [201, 302, 400, 502, 800, 801, 802, 803].indexOf(answer.body.code) > - -1 - ) { - // 特殊状态码 - answer.status = 200 - } - } catch (e) { - // console.log(e) - answer.body = body - answer.status = res.status - } - - answer.status = - 100 < answer.status && answer.status < 600 ? answer.status : 400 - if (answer.status == 200) resolve(answer) - else reject(answer) - }) - .catch((err) => { - answer.status = 502 - answer.body = { code: 502, msg: err } - reject(answer) - }) - }) -} - -module.exports = createRequest diff --git a/packages/api/vercel.json b/packages/api/vercel.json deleted file mode 100644 index d22ecccb..00000000 --- a/packages/api/vercel.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "builds": [ - { "src": "*.html", "use": "@vercel/static" }, - { "src": "*.js", "use": "@vercel/node" } - ], - "routes": [ - { "src": "/.*", "dest": "/app.js" } - ] -} diff --git a/packages/md2vue-loader/.gitignore b/packages/md2vue-loader/.gitignore deleted file mode 100644 index 2905f456..00000000 --- a/packages/md2vue-loader/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/.idea -/node_modules -/dist diff --git a/packages/md2vue-loader/README.md b/packages/md2vue-loader/README.md deleted file mode 100644 index da80e755..00000000 --- a/packages/md2vue-loader/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# md2vue-loader - -[https://github.com/Linkontoask/md2vue-loader](https://github.com/Linkontoask/md2vue-loader) diff --git a/packages/md2vue-loader/index.js b/packages/md2vue-loader/index.js deleted file mode 100644 index 4737353d..00000000 --- a/packages/md2vue-loader/index.js +++ /dev/null @@ -1,165 +0,0 @@ -const { getOptions } = require('loader-utils'); -const validateOptions = require('schema-utils'); -const MarkdownIt = require('markdown-it'); -const Hljs = require('highlight.js'); -const slugify = require('transliteration').slugify; -const compiler = require('@vue/compiler-sfc'); -const hashsum = require('hash-sum'); -const path = require('path'); - -const schema = { - type: 'object', - properties: { - html: { - type: "boolean" - } - } -}; - -function mdOption (options = {}) { - return new MarkdownIt({ - html: options.html, - highlight: function (str, lang) { - if (lang && Hljs.getLanguage(lang)) { - try { - return Hljs.highlight(lang, str, true).value; - } catch (e) { - console.error(e) - } - } - return str; - } - }).use(require('markdown-it-anchor'), { - slugify: slugify, - permalink: options.permalink - }); -} - -/** Friendly error display */ -function displayError({contents, filePath, error}) { - const pad = (number, pad) => `${Array.from(new Array(pad + 1)).join(' ')}${number}`; - - let output = [`${error.toString()}`, `[${filePath}]`]; - if (error.loc) { - output[1] += ` Line ${error.loc.start.line}, Column ${error.loc.start.column}`; - const lineNo = (number) => - ' ' + - pad(number, (error.loc.end.line + 1).toString().length - number.toString().length) + - ' | '; - output.push(''); - const allLines = ['', ...contents.split('\n')]; - let currentLine = error.loc.start.line; - output.push(lineNo(currentLine - 1) + allLines[currentLine - 1]); - while (currentLine <= error.loc.end.line) { - output.push(lineNo(currentLine) + allLines[currentLine]); - currentLine++; - } - output.push( - Array.from(new Array(error.loc.start.column + lineNo(currentLine - 1).length)).join(' ') + - '^', - ); - output.push(lineNo(currentLine) + allLines[currentLine]); - } - return output.join('\n'); -} - -/** - * @param source - * @returns {string} - */ -module.exports = async function (source) { - const options = getOptions(this); - - validateOptions(schema, options); - - const mdSource = mdOption(options).render(source.replace(/^