Skip to content

Commit ffd3c50

Browse files
committed
add: 123
123网盘可推送观看
1 parent 03bbaf5 commit ffd3c50

File tree

7 files changed

+282
-4
lines changed

7 files changed

+282
-4
lines changed

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ nodejs作为服务端的drpy实现。全面升级异步写法
1919

2020
## 更新记录
2121

22+
### 20250226
23+
24+
更新至V1.1.21
25+
2226
### 20250225
2327

2428
更新至V1.1.20

Diff for: docs/updateRecord.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# drpyS更新记录
22

3+
### 20250226
4+
5+
更新至V1.1.21
6+
7+
1. 增加123网盘的逻辑和推送示例
8+
39
### 20250225
410

511
更新至V1.1.20

Diff for: js/push_agent.js

+43-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var rule = {
5656
let list = input.split('@');
5757
// log(list);
5858
for (let i = 0; i < list.length; i++) {
59-
if (/pan.quark.cn|drive.uc.cn|www.alipan.com|www.aliyundrive.com|cloud.189.cn|yun.139.com/.test(list[i])) {
59+
if (/pan.quark.cn|drive.uc.cn|www.alipan.com|www.aliyundrive.com|cloud.189.cn|yun.139.com|www.123684.com/.test(list[i])) {
6060
if (/pan.quark.cn/.test(list[i])) {
6161
playPans.push(list[i]);
6262
const shareData = Quark.getShareData(list[i]);
@@ -127,12 +127,24 @@ var rule = {
127127
playurls.push(urls);
128128
})
129129
}
130+
131+
if(/www.123684.com/.test(list[i])) {
132+
playPans.push(list[i]);
133+
let shareData = Pan.getShareData(list[i])
134+
let videos = await Pan.getFilesByShareUrl(shareData)
135+
if (videos.length > 0) {
136+
playform.push('Pan123-' + shareData);
137+
const urls = videos.map(item => item.FileName + "$" + [item.ShareKey, item.FileId, item.S3KeyFlag, item.Size, item.Etag].join('*')).join('#');
138+
playurls.push(urls);
139+
}
140+
}
141+
130142
} else {
131143
playform.push('推送');
132144
playurls.push("推送" + '$' + list[i])
133145
}
134146
}
135-
} else if (/pan.quark.cn|drive.uc.cn|www.alipan.com|www.aliyundrive.com|cloud.189.cn|yun.139.com/.test(input)) {
147+
} else if (/pan.quark.cn|drive.uc.cn|www.alipan.com|www.aliyundrive.com|cloud.189.cn|yun.139.com|www.123684.com/.test(input)) {
136148
if (/pan.quark.cn/.test(input)) {
137149
playPans.push(input);
138150
const shareData = Quark.getShareData(input);
@@ -172,7 +184,6 @@ var rule = {
172184
const shareData = Ali.getShareData(input);
173185
if (shareData) {
174186
const videos = await Ali.getFilesByShareUrl(shareData);
175-
log(videos);
176187
if (videos.length > 0) {
177188
playform.push('Ali-' + shareData.shareId);
178189
playurls.push(videos.map((v) => {
@@ -203,6 +214,17 @@ var rule = {
203214
playurls.push(urls);
204215
})
205216
}
217+
218+
if(/www.123684.com/.test(input)) {
219+
playPans.push(input);
220+
let shareData = Pan.getShareData(input)
221+
let videos = await Pan.getFilesByShareUrl(shareData)
222+
if (videos.length > 0) {
223+
playform.push('Pan123-' + shareData);
224+
const urls = videos.map(item => item.FileName + "$" + [item.ShareKey, item.FileId, item.S3KeyFlag, item.Size, item.Etag].join('*')).join('#');
225+
playurls.push(urls);
226+
}
227+
}
206228
} else {
207229
playform.push('推送');
208230
playurls.push("推送" + '$' + input)
@@ -222,7 +244,7 @@ var rule = {
222244
} else {
223245
return {parse: 1, url: input}
224246
}
225-
} else if (/Quark-|UC-|Ali-|Cloud-|Yun-/.test(flag)) {
247+
} else if (/Quark-|UC-|Ali-|Cloud-|Yun-|Pan123-/.test(flag)) {
226248
const ids = input.split('*');
227249
const urls = [];
228250
let UCDownloadingCache = {};
@@ -304,6 +326,23 @@ var rule = {
304326
url: url
305327
}
306328
}
329+
if(flag.startsWith('Pan123-')) {
330+
log('盘123解析开始')
331+
const url = await Pan.getDownload(ids[0], ids[1], ids[2], ids[3], ids[4])
332+
urls.push("原画", url + "#isVideo=true#")
333+
log('jj:',url)
334+
let data = await Pan.getLiveTranscoding(ids[0], ids[1], ids[2], ids[3], ids[4])
335+
data.forEach((item) => {
336+
urls.push(item.name, item.url)
337+
})
338+
return {
339+
parse: 0,
340+
url: urls,
341+
header: {
342+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
343+
}
344+
}
345+
}
307346
} else {
308347
return input
309348
}

Diff for: js/设置中心.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ let quick_data = {
2323
移动1: 'https://yun.139.com/shareweb/#/w/i/0i5CLQ7BpV7Ai',
2424
移动2: 'https://caiyun.139.com/m/i?2jexC1gcjeN7q',
2525
移动3: 'https://yun.139.com/shareweb/#/w/i/2i2MoE9ZHn9p1',
26+
123: 'https://www.123684.com/s/oec7Vv-DggWh?ZY4K',
2627
直链1: 'https://vdse.bdstatic.com//628ca08719cef5987ea2ae3c6f0d2386.mp4',
2728
嗅探1: 'https://www.6080kk.cc/haokanplay/178120-1-1.html',
2829
嗅探2: 'https://www.hahads.com/play/537106-3-1.html',

Diff for: libs/drpyS.js

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {UC} from "../utils/uc.js";
2020
import {Ali} from "../utils/ali.js";
2121
import {Cloud} from "../utils/cloud.js";
2222
import {Yun} from "../utils/yun.js";
23+
import {Pan} from "../utils/pan123.js";
2324
import AIS from '../utils/ais.js';
2425
// const { req } = await import('../utils/req.js');
2526
import {gbkTool} from '../libs_drpy/gbk.js'
@@ -58,6 +59,7 @@ globalThis.UC = UC;
5859
globalThis.Ali = Ali;
5960
globalThis.Cloud = Cloud;
6061
globalThis.Yun = Yun;
62+
globalThis.Pan = Pan;
6163
globalThis.require = createRequire(import.meta.url);
6264
globalThis._fetch = fetch;
6365
globalThis.XMLHttpRequest = XMLHttpRequest;
@@ -312,6 +314,7 @@ export async function getSandbox(env = {}) {
312314
Ali,
313315
Cloud,
314316
Yun,
317+
Pan,
315318
DataBase,
316319
database,
317320
require,

Diff for: public/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ <h1 id="drpysdrpy-node">drpyS(drpy-node)</h1>
2424
<li><a href="/cat/index.html">在线猫ds源主页</a></li>
2525
</ul>
2626
<h2 id="更新记录">更新记录</h2>
27+
<h3 id="20250226">20250226</h3>
28+
<p>更新至V1.1.21</p>
2729
<h3 id="20250225">20250225</h3>
2830
<p>更新至V1.1.20</p>
2931
<h3 id="20250224">20250224</h3>

Diff for: utils/pan123.js

+223
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
import axios from "axios";
2+
import {ENV} from "./env.js";
3+
4+
5+
class Pan123 {
6+
constructor() {
7+
this.regex = /https:\/\/www.123684.com\/s\/([^\\/]+)/
8+
this.api = 'https://www.123684.com/b/api/share/';
9+
this.loginUrl = 'https://login.123pan.com/api/user/sign_in';
10+
}
11+
12+
async init() {
13+
if(this.passport){
14+
console.log("获取盘123账号成功")
15+
}
16+
if(this.password){
17+
console.log("获取盘123密码成功")
18+
}
19+
if(this.auth){
20+
let info = JSON.parse(CryptoJS.enc.Base64.parse(this.auth.split('.')[1]).toString(CryptoJS.enc.Utf8))
21+
if(info.exp > Math.floor(Date.now() / 1000)){
22+
console.log("登录成功")
23+
}else {
24+
console.log("登录过期,重新登录")
25+
await this.loin()
26+
}
27+
}else {
28+
console.log("尚未登录,开始登录")
29+
await this.loin()
30+
}
31+
}
32+
33+
get passport(){
34+
return ENV.get('pan_passport')
35+
}
36+
37+
get password(){
38+
return ENV.get('pan_password')
39+
}
40+
41+
get auth(){
42+
return ENV.get('pan_auth')
43+
}
44+
45+
async loin(){
46+
let data = JSON.stringify({
47+
"passport": this.passport,
48+
"password": this.password,
49+
"remember": true
50+
});
51+
let config = {
52+
method: 'POST',
53+
url: this.loginUrl,
54+
headers: {
55+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
56+
'Content-Type': 'application/json',
57+
'App-Version': '43',
58+
'Referer': 'https://login.123pan.com/centerlogin?redirect_url=https%3A%2F%2Fwww.123684.com&source_page=website',
59+
},
60+
data: data
61+
};
62+
63+
let auth = (await axios.request(config)).data
64+
ENV.set('pan_auth',auth.data.token)
65+
}
66+
67+
getShareData(url){
68+
url = decodeURIComponent(url);
69+
const matches = this.regex.exec(url);
70+
if(url.indexOf('?') > 0){
71+
this.SharePwd = url.split('?')[1].match(/[A-Za-z0-9]+/)[0];
72+
console.log(this.SharePwd)
73+
}
74+
if (matches) {
75+
if(matches[1].indexOf('?') > 0){
76+
return matches[1].split('?')[0]
77+
}else {
78+
return matches[1]
79+
}
80+
81+
}
82+
return null;
83+
}
84+
85+
async getFilesByShareUrl(shareKey){
86+
return await this.getShareInfo(shareKey, this.SharePwd, 0, 0)
87+
}
88+
89+
async getShareInfo(shareKey,SharePwd,next,ParentFileId) {
90+
let filelist = []
91+
let list = await axios.get(this.api+"get",{
92+
headers: {},
93+
params: {
94+
"limit": "100",
95+
"next": "0",
96+
"orderBy": "file_name",
97+
"orderDirection": "asc",
98+
"shareKey": shareKey,
99+
"SharePwd": SharePwd,
100+
"ParentFileId": "0",
101+
"Page": "1"
102+
}
103+
});
104+
if(list.status === 200){
105+
if(list.data.code === 5103){
106+
console.log(list.data.message);
107+
}else {
108+
let info = list.data.data;
109+
let next = info.Next;
110+
let infoList = info.InfoList
111+
for (let i = 0; i < infoList.length; i++) {
112+
let data = infoList[i];
113+
if(data.Category === 2){
114+
filelist.push({
115+
ShareKey: shareKey,
116+
FileId: data.FileId,
117+
S3KeyFlag: data.S3KeyFlag,
118+
Size: data.Size,
119+
Etag: data.Etag,
120+
FileName: data.FileName,
121+
})
122+
}
123+
let FileId = data.FileId
124+
let file = await this.getShareList(shareKey,SharePwd,next,FileId);
125+
filelist.push(...file)
126+
}
127+
128+
return filelist;
129+
}
130+
}
131+
}
132+
133+
async getShareList(shareKey,SharePwd,next,ParentFileId) {
134+
let video = []
135+
let infoList = (await axios.get(this.api+"get",{
136+
headers: {},
137+
params: {
138+
"limit": "100",
139+
"next": next,
140+
"orderBy": "file_name",
141+
"orderDirection": "asc",
142+
"shareKey": shareKey,
143+
"SharePwd": SharePwd,
144+
"ParentFileId": ParentFileId,
145+
"Page": "1"
146+
}
147+
})).data.data.InfoList;
148+
for (let i = 0; i < infoList.length; i++) {
149+
let data = infoList[i];
150+
if(data.Category === 2){
151+
video.push({
152+
ShareKey: shareKey,
153+
FileId: data.FileId,
154+
S3KeyFlag: data.S3KeyFlag,
155+
Size: data.Size,
156+
Etag: data.Etag,
157+
FileName: data.FileName,
158+
})
159+
}else {
160+
let FileId = data.FileId
161+
return await this.getShareList(shareKey, SharePwd, next, FileId)
162+
}
163+
}
164+
return video;
165+
}
166+
167+
async getDownload(shareKey,FileId,S3KeyFlag,Size,Etag) {
168+
await this.init();
169+
let data = JSON.stringify({
170+
"ShareKey": shareKey,
171+
"FileID": FileId,
172+
"S3KeyFlag": S3KeyFlag,
173+
"Size": Size,
174+
"Etag": Etag
175+
});
176+
let config = {
177+
method: 'POST',
178+
url: `${this.api}download/info`,
179+
headers: {
180+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
181+
'Authorization': `Bearer ${this.auth}`,
182+
'Content-Type': 'application/json;charset=UTF-8',
183+
'platform': 'android',
184+
},
185+
data: data
186+
};
187+
let down = (await axios.request(config)).data.data
188+
return down.DownloadURL;
189+
}
190+
191+
async getLiveTranscoding(shareKey,FileId,S3KeyFlag,Size,Etag){
192+
await this.init();
193+
let config = {
194+
method: 'GET',
195+
url: `https://www.123684.com/b/api/video/play/info`,
196+
headers: {
197+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
198+
'Authorization': `Bearer ${this.auth}`,
199+
'Content-Type': 'application/json;charset=UTF-8',
200+
'platform': 'android',
201+
},
202+
params:{
203+
"etag": Etag,
204+
"size": Size,
205+
"from": "1",
206+
"shareKey": shareKey
207+
}
208+
};
209+
let down = (await axios.request(config)).data.data.video_play_info
210+
let videoinfo = []
211+
down.forEach(item => {
212+
if(item.url!==''){
213+
videoinfo.push({
214+
name:item.resolution,
215+
url:item.url
216+
})
217+
}
218+
})
219+
return videoinfo;
220+
}
221+
}
222+
223+
export const Pan = new Pan123();

0 commit comments

Comments
 (0)