✨ feat: 新增小红书解析
@ -9,7 +9,7 @@
|
||||
个人团队用的<a href="https://gitee.com/Le-niao/Yunzai-Bot" target="_blank">Yunzai-Bot</a>插件,插件的各种业务来源于周围人
|
||||
<img src="https://cdn.jsdelivr.net/gh/xianxincoder/xianxincoder/assets/github-contribution-grid-snake.svg">
|
||||
</div>
|
||||
|
||||

|
||||
## 🗃️文件架构
|
||||
apps -- 业务核心
|
||||
|
||||
@ -27,6 +27,7 @@ index -- 主入口
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## 🤺BUG及时交流群
|
||||

|
||||
|
@ -441,19 +441,32 @@ export class tools extends plugin {
|
||||
const reg = /<img(.*)src="\/\/ci\.xiaohongshu\.com(.*?)"/g
|
||||
let res = '';
|
||||
|
||||
let images = [];
|
||||
while (res = reg.exec(resp.data)) {
|
||||
console.log(`https://ci.xiaohongshu.com${res[2]}`)
|
||||
images.push({
|
||||
message: segment.image(`https://ci.xiaohongshu.com${res[2]}`),
|
||||
nickname: e.sender.card || e.user_id,
|
||||
user_id: e.user_id
|
||||
})
|
||||
const downloadPath = `${ this.defaultPath }${ this.e.group_id || this.e.user_id }`;
|
||||
// 创建文件夹(如果没有过这个群)
|
||||
if (!fs.existsSync(downloadPath)) {
|
||||
mkdirsSync(downloadPath);
|
||||
}
|
||||
if (images.length > 0) {
|
||||
e.reply(Bot.makeForwardMsg(images))
|
||||
} else {
|
||||
e.reply("解析失败,重新解析下");
|
||||
while (res = reg.exec(resp.data)) {
|
||||
const addr = `https://ci.xiaohongshu.com${res[2]}`
|
||||
axios.get(addr, {
|
||||
headers: {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
||||
},
|
||||
responseType: "stream",
|
||||
}).then(resp => {
|
||||
const filepath = `${downloadPath}/${/com\/(.*)\?/.exec(addr)[1]}.jpg`
|
||||
const writer = fs.createWriteStream(filepath);
|
||||
resp.data.pipe(writer)
|
||||
return new Promise((resolve, reject) => {
|
||||
writer.on('finish', () => resolve(filepath));
|
||||
writer.on('error', reject);
|
||||
});
|
||||
})
|
||||
.then( filepath => {
|
||||
e.reply(segment.image(fs.readFileSync(filepath)))
|
||||
fs.unlinkSync(filepath)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -52,6 +52,12 @@
|
||||
- icon: 推特
|
||||
title: "twitter"
|
||||
desc: 推特学习版分享实时下载
|
||||
- icon: acfun
|
||||
title: "acfun"
|
||||
desc: 猴山分享实时下载
|
||||
- icon: redbook
|
||||
title: "小红书"
|
||||
desc: 小红书分享实时下载
|
||||
- group: 其他指令[实验]
|
||||
list:
|
||||
- icon: update
|
||||
|
@ -1,8 +1,8 @@
|
||||
- {
|
||||
version: 1.0.2,
|
||||
version: 1.0.3,
|
||||
data:
|
||||
[
|
||||
更改单个组件<span class="cmd">#任助理</span>架构为插件架构,
|
||||
增加<span class="cmd">#小红书</span>的图片解析,
|
||||
添加<span class="cmd">#R帮助</span>获取插件帮助,
|
||||
添加<span class="cmd">#R版本</span>获取插件版本,
|
||||
更新风控缓解、重构系统文件、增加部分接口撤回操作
|
||||
|
BIN
img/example4.png
Normal file
After Width: | Height: | Size: 475 KiB |
BIN
img/help.jpg
Before Width: | Height: | Size: 354 KiB After Width: | Height: | Size: 376 KiB |
BIN
img/version.jpg
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 157 KiB |
BIN
resources/img/icon/acfun.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
resources/img/icon/redbook.png
Normal file
After Width: | Height: | Size: 3.7 KiB |