Skip to content

Commit dc89688

Browse files
committed
update: 增加MV源
1 parent a4e8757 commit dc89688

File tree

9 files changed

+165561
-16
lines changed

9 files changed

+165561
-16
lines changed

Diff for: README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# drpyS(drpy-node)
22

33
nodejs作为服务端的drpy实现。全面升级异步写法
4-
积极开发中,每日一更,当前进度 `46%`
4+
~~积极开发中,每日一更~~,当前进度 `48%`
5+
找工作中,随缘更新
56

67
* [本地配置接口-动态本地](/config?pwd=)
78
* [本地配置接口-动态外网/局域网](/config/1?pwd=)
@@ -18,6 +19,14 @@ nodejs作为服务端的drpy实现。全面升级异步写法
1819

1920
## 更新记录
2021

22+
### 20250211
23+
24+
更新至V1.1.18
25+
26+
### 20250206
27+
28+
更新至V1.1.17
29+
2130
### 20250123
2231

2332
更新至V1.1.16

Diff for: config/map.txt

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
采集之王[合]@?type=url&params=../json/采集[密]静态.json$1$@采王成人[密]
88
采集之王[合]@?type=url&params=../json/采集2024静态.json$1$@采王2024
99
UC分享@?type=url&params=../json/UC分享.json@UC分享[盘]
10+
16wMV[听]@?type=url&params=../json/十六万歌曲.txt

Diff for: docs/updateRecord.md

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

3+
### 20250211
4+
5+
更新至V1.1.18
6+
7+
1. 新增 `16wMv.js`
8+
2. drpyS支持库升级,新增获取首字母拼音的函数 `getFirstLetter`
9+
310
### 20250206
411

512
更新至V1.1.17

Diff for: js/16wMV[听].js

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
var mv_list = [];
2+
var authors = [];
3+
const starAuthors = '周杰伦,汪苏泷,李荣浩,蔡依林,筷子兄弟,凤凰传奇,程响';
4+
const alphabetList = Array.from({length: 26}, (_, index) => {
5+
const uppercase = String.fromCharCode(65 + index); // 大写字母 A-Z
6+
const lowercase = String.fromCharCode(97 + index); // 小写字母 a-z
7+
// return {n: uppercase, v: lowercase};
8+
return {n: uppercase, v: uppercase};
9+
});
10+
alphabetList.unshift({n: '全部', v: ''});
11+
var rule = {
12+
类型: '搜索',
13+
title: '16wMV',
14+
alias: '16wMV搜索引擎',
15+
desc: '仅搜索源纯js写法',
16+
host: 'hiker://empty',
17+
url: '',
18+
searchUrl: 'hiker://empty',
19+
headers: {
20+
'User-Agent': 'PC_UA',
21+
},
22+
searchable: 1,
23+
quickSearch: 0,
24+
filterable: 1,
25+
double: true,
26+
play_parse: true,
27+
limit: 100,
28+
class_name: '歌手',
29+
class_url: 'author',
30+
filter: {
31+
author: [
32+
{key: 'letters', name: '首字母', value: alphabetList}
33+
]
34+
},
35+
// 推荐样式
36+
hikerListCol: 'icon_round_2',
37+
// 分类列表样式
38+
hikerClassListCol: 'avatar',
39+
// home_flag: '3-0-S',
40+
home_flag: '3',
41+
// class_flag: '3-11-S',
42+
class_flag: '1',
43+
预处理: async function () {
44+
let t1 = (new Date()).getTime();
45+
let _url = rule.params;
46+
log(`传入参数:${_url}`);
47+
mv_list = (await request(_url)).split('\n').map((it) => {
48+
it = it.trim();
49+
let _tt = it.split(',')[0];
50+
let _uu = it.split(',')[1];
51+
if (_tt.includes('-')) {
52+
return {title: _tt, url: _uu, author: _tt.split('-')[0].trim() || '未知', name: _tt.split('-')[1].trim()}
53+
} else {
54+
return {title: _tt, url: _uu, author: '未知', name: _tt.trim()}
55+
}
56+
});
57+
authors = [...new Set(mv_list.filter(it => !it.author.includes('+')).map(it => it.author.trim()))];
58+
// log(mv_list.slice(0, 3));
59+
// authors = naturalSort(authors, 'author'); // 不要使用排序,数据太大了排不了
60+
authors = authors.sort((a, b) => a.localeCompare(b, 'zh-CN', {numeric: true, sensitivity: 'base'}));
61+
let t2 = (new Date()).getTime();
62+
log(`读取文件并转json耗时:${t2 - t1}毫秒`);
63+
},
64+
lazy: async function () {
65+
},
66+
proxy_rule: async function (params) {
67+
let {input, proxyPath, getProxyUrl} = this;
68+
let resp_not_found = [404, 'text/plain', 'not found'];
69+
return resp_not_found
70+
},
71+
action: async function (action, value) {
72+
if (action === 'only_search') {
73+
return '此源为纯搜索源,你直接全局搜索这个源或者使用此页面的源内搜索就好了'
74+
}
75+
if (action === '源内搜索') {
76+
let content = JSON.parse(value);
77+
return JSON.stringify({
78+
action: {
79+
actionId: '__self_search__',
80+
skey: '', //目标源key,可选,未设置或为空则使用当前源
81+
name: '搜索: ' + content.wd,
82+
tid: content.wd,
83+
flag: '1',
84+
msg: '源内搜索'
85+
}
86+
});
87+
}
88+
return `没有动作:${action}的可执行逻辑`
89+
},
90+
推荐: async function () {
91+
let {publicUrl} = this;
92+
let searchIcon = urljoin(publicUrl, './images/icon_cookie/搜索.jpg');
93+
let selectData = starAuthors.split(',').map(it => `${it}:=${it}`).join(',');
94+
return [{
95+
vod_id: 'only_search',
96+
vod_name: '这是个纯搜索源哦',
97+
vod_pic: searchIcon,
98+
vod_remarks: `歌手数量:${authors.length}`,
99+
vod_tag: 'action'
100+
},
101+
{
102+
vod_id: JSON.stringify({
103+
actionId: '源内搜索',
104+
id: 'wd',
105+
type: 'input',
106+
title: '源内搜索',
107+
tip: '请输入搜索内容',
108+
value: '',
109+
selectData: selectData
110+
}),
111+
vod_name: '源内搜索',
112+
vod_pic: searchIcon,
113+
vod_tag: 'action',
114+
}
115+
]
116+
},
117+
一级: async function (tid, pg, filter, extend) {
118+
let {MY_FL} = this;
119+
let d = [];
120+
if (tid === 'author') {
121+
let _f = rule.limit * (pg - 1);
122+
let _t = rule.limit * pg;
123+
let _d = [];
124+
let _authors = authors;
125+
// log('_f:', _f, '_t:', _t);
126+
// log('MY_FL.letters:', MY_FL.letters);
127+
if (MY_FL.letters) {
128+
_authors = authors.filter(_author => getFirstLetter(_author).startsWith(MY_FL.letters));
129+
}
130+
_d = _authors.slice(_f, _t);
131+
_d.forEach(it => {
132+
d.push({
133+
vod_name: it,
134+
vod_id: 'author#' + it,
135+
});
136+
});
137+
return d;
138+
}
139+
// 仅搜索作者允许翻页,其他情况只有3个固定按钮
140+
if (Number(pg) > 1) {
141+
return []
142+
}
143+
d.push({
144+
vod_name: '按歌手搜索',
145+
vod_id: 'author#' + tid,
146+
vod_remarks: '',
147+
});
148+
d.push({
149+
vod_name: '按歌名搜索',
150+
vod_id: 'name#' + tid,
151+
vod_remarks: '',
152+
});
153+
d.push({
154+
vod_name: '全名模糊搜索',
155+
vod_id: 'all#' + tid,
156+
vod_remarks: '',
157+
});
158+
return d
159+
},
160+
二级: async function () {
161+
let {orId} = this;
162+
let _stype = orId.split('#')[0];
163+
let _sname = orId.split('#')[1];
164+
let _vname = '';
165+
let data = [];
166+
switch (_stype) {
167+
case 'author':
168+
// log('_sname:', _sname);
169+
_vname = '按歌手搜索';
170+
data = mv_list.filter(it => it.author.includes(_sname));
171+
break;
172+
case 'name':
173+
_vname = '按歌名搜索';
174+
data = mv_list.filter(it => it.name.includes(_sname));
175+
break;
176+
default:
177+
_vname = '全名模糊搜索';
178+
data = mv_list.filter(it => it.title.includes(_sname));
179+
break;
180+
}
181+
return {
182+
vod_id: orId,
183+
vod_name: `${_vname}:${_sname}`,
184+
vod_remarks: `共计${data.length}`,
185+
vod_play_from: '道长源内搜索',
186+
vod_play_url: data.map(it => it.title + '$' + it.url).join('#')
187+
}
188+
},
189+
搜索: async function (wd, quick, pg) {
190+
if (Number(pg) > 1) {
191+
return []
192+
}
193+
let d = [];
194+
d.push({
195+
vod_name: '按歌手搜索:' + wd,
196+
vod_id: 'author#' + wd,
197+
vod_remarks: '',
198+
});
199+
d.push({
200+
vod_name: '按歌名搜索:' + wd,
201+
vod_id: 'name#' + wd,
202+
vod_remarks: '',
203+
});
204+
d.push({
205+
vod_name: '全名模糊搜索:' + wd,
206+
vod_id: 'all#' + wd,
207+
vod_remarks: '',
208+
});
209+
return d
210+
}
211+
}

0 commit comments

Comments
 (0)