更新源,添加RM123,删除不能访问的源
parent
5b065ad15e
commit
40072d14be
24
app/main.js
24
app/main.js
|
@ -7,7 +7,9 @@ const { SuccessResult, ErrorResult } = require('./model/ResultModel');
|
|||
|
||||
const { QQSource } = require('./source/QQSource');
|
||||
const mfm = require('./source/MyFreemp3Source');
|
||||
const rm123 = require('./source/RM123Source');
|
||||
const { KugouSource } = require('./source/KugouSource');
|
||||
const { rm } = require("fs");
|
||||
|
||||
// 防止进程中断
|
||||
// process.on('uncaughtException', function (err) {
|
||||
|
@ -19,18 +21,20 @@ const searcher = new SearchModel();
|
|||
//searcher.registerSourceModel(new QQSource());
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3QQSource());
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3NeteaseSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3KugouSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3KugouSource()); 不能使用
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3KuwoSource());
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3MiguSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3MiguSource());不能使用
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3QianqianSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3QingtingSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3XimalayaSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3LizhiSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3KgSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp31tingSource());
|
||||
// searcher.registerSourceModel(new mfm.MyFreemp35singycSource());
|
||||
// searcher.registerSourceModel(new mfm.MyFreemp35singfcSource());
|
||||
//searcher.registerSourceModel(new KugouSource());
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3QingtingSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3XimalayaSource());不能使用
|
||||
searcher.registerSourceModel(new mfm.MyFreemp3LizhiSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp3KgSource());不能使用
|
||||
searcher.registerSourceModel(new mfm.MyFreemp31tingSource());
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp35singycSource());不能使用
|
||||
//searcher.registerSourceModel(new mfm.MyFreemp35singfcSource());不能使用
|
||||
//searcher.registerSourceModel(new KugouSource()); 不能使用
|
||||
searcher.registerSourceModel(new rm123.RM123MiguSource());
|
||||
// searcher.registerSourceModel(new rm123.RM123XimalayaSource());不能使用
|
||||
|
||||
|
||||
// ***********************************************************************
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
const { SourceModel } = require('../model/SourceModel');
|
||||
|
||||
class RM123Source extends SourceModel {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = '';
|
||||
this.name = '';
|
||||
}
|
||||
|
||||
getExtension(url) {
|
||||
return url.toLowerCase();
|
||||
}
|
||||
|
||||
async search(keywords) {
|
||||
keywords = encodeURIComponent(keywords);
|
||||
// POST请求
|
||||
let options = {
|
||||
url: `https://music.rm123.cn/?name=${keywords}&type=${this.type}`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
//'Host': 'RM123.sharerj.com',
|
||||
//'Origin': 'http://RM123.sharerj.com',
|
||||
//'Referer': `http://RM123.sharerj.com/?name=${keywords}&type=qq`,
|
||||
//'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.183',
|
||||
//'Accept': 'application/json, text/javascript, */*; q=0.01',
|
||||
'X-Requested-With': 'XMLHttpRequest', //此行必须填写
|
||||
//'Cookie': '__gads=ID=f167a79e430852c8-227b3bd2b6e70079:T=1690680059:RT=1690680059:S=ALNI_MZixvU2-9BVQv0qTuN2kVnZttuZIQ; __gpi=UID=00000d30f9e155c5:T=1690680059:RT=1690680059:S=ALNI_MZtwSz24f5LJ-tGCRKRuzz0AFH5rA'
|
||||
},
|
||||
json: true, //将body解析为json
|
||||
body: `input=${keywords}&filter=name&type=${this.type}&page=1`
|
||||
};
|
||||
|
||||
let result = await this.request(options);
|
||||
if(result.data instanceof Array) {
|
||||
result = result.data.map(item => {
|
||||
return {
|
||||
title: item.title,
|
||||
author: item.author,
|
||||
url: item.url,
|
||||
link: item.link,
|
||||
lrc: item.lrc,
|
||||
pic: item.pic,
|
||||
source_name: this.getName(),
|
||||
extension: item.url ? this.checkExtension(this.getExtension(item.url)) : ''
|
||||
}
|
||||
});
|
||||
}else {
|
||||
result = result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class RM123QQSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'qq';
|
||||
this.name = "RM123_QQ";
|
||||
}
|
||||
|
||||
getExtension(url) {
|
||||
return url.split('?')[0].split('/').pop().split('.').pop().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
class RM123NeteaseSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'netease';
|
||||
this.name = "RM123_网易";
|
||||
}
|
||||
|
||||
getExtension(url) {
|
||||
return url.split('.').pop().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
class RM123KugouSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'kugou';
|
||||
this.name = "RM123_酷狗";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123KuwoSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'kuwo';
|
||||
this.name = "RM123_酷我";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123QianqianSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'baidu';
|
||||
this.name = "RM123_千千";
|
||||
}
|
||||
}
|
||||
|
||||
class RM1231tingSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = '1ting';
|
||||
this.name = "RM123_一听";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123MiguSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'migu';
|
||||
this.name = "RM123_咪咕";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123LizhiSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'lizhi';
|
||||
this.name = "RM123_荔枝";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123QingtingSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'qingting';
|
||||
this.name = "RM123_蜻蜓";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123XimalayaSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'ximalaya';
|
||||
this.name = "RM123_喜马拉雅";
|
||||
}
|
||||
}
|
||||
|
||||
class RM1235singycSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = '5singyc';
|
||||
this.name = "RM123_5sing原创";
|
||||
}
|
||||
}
|
||||
|
||||
class RM1235singfcSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = '5singfc';
|
||||
this.name = "RM123_5sing翻唱";
|
||||
}
|
||||
}
|
||||
|
||||
class RM123KgSource extends RM123Source {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'kg';
|
||||
this.name = "RM123_全民K歌";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
RM123QQSource,
|
||||
RM123NeteaseSource,
|
||||
RM123KugouSource,
|
||||
RM123KuwoSource,
|
||||
RM123QianqianSource,
|
||||
RM1231tingSource,
|
||||
RM123MiguSource,
|
||||
RM123LizhiSource,
|
||||
RM123QingtingSource,
|
||||
RM123XimalayaSource,
|
||||
RM1235singycSource,
|
||||
RM1235singfcSource,
|
||||
RM123KgSource
|
||||
}
|
|
@ -64,7 +64,7 @@
|
|||
</Row>
|
||||
<Row style="vertical-align: middle; line-height: 32px;">
|
||||
<i-col span="4">作者:</i-col>
|
||||
<i-col span="20">{{ current_item.author }}</i-col>
|
||||
<i-col span="20">{{ current_item.author || '未知作者' }}</i-col>
|
||||
</Row>
|
||||
<Row style="vertical-align: middle; line-height: 32px;">
|
||||
<i-col span="4">链接:</i-col>
|
||||
|
@ -111,7 +111,7 @@
|
|||
</i-col>
|
||||
<i-col span="16">
|
||||
<p style="display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;" :title="item2.title">{{ item2.title }}</p>
|
||||
<p style="color:#bbb">{{ item2.author }}</p>
|
||||
<p style="color:#bbb">{{ item2.author || '未知作者' }}</p>
|
||||
<p><Tag>{{ item2.extension || '未知格式' }}</Tag><Tag :color="['default','primary','success','error','warning','magenta','red','volcano','orange','gold','yellow'][item2.number%11]">{{ item2.source_name }}</Tag></p>
|
||||
</i-col>
|
||||
</Row>
|
||||
|
@ -201,6 +201,8 @@
|
|||
let list = await this.search(selected_sources[i], keywords, result);
|
||||
list.forEach(item => {
|
||||
item.number = i; //主要用来打标记
|
||||
item.title = item.title || '';
|
||||
item.author = item.author || '';
|
||||
item.lrc = item.lrc ? htmlparser.parseFromString(item.lrc, 'text/html').documentElement.textContent : ''; // 防止有转义字符
|
||||
result.push(item);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue