mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
feat(script): 新增链接提取/图片下载选择模式开关
This commit is contained in:
parent
3fe81aa124
commit
08c5443289
@ -234,7 +234,8 @@ async def example_api():
|
|||||||
<li>为了避免请求频率过高对平台服务器造成影响,本项目内置请求延时机制</li>
|
<li>为了避免请求频率过高对平台服务器造成影响,本项目内置请求延时机制</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h1 id="user-scripts">🕹 用户脚本</h1>
|
<h1 id="user-scripts">🕹 用户脚本</h1>
|
||||||
<p>如果您的浏览器安装了 <a href="https://www.tampermonkey.net/">Tampermonkey</a> 浏览器扩展程序,可以添加 <a href="https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/master/static/XHS-Downloader.js">用户脚本</a>(右键单击复制链接),无需下载安装即可体验项目功能!</p>
|
<p>如果您的浏览器安装了 <a href="https://www.tampermonkey.net/">Tampermonkey</a> 浏览器扩展程序,可以使用用户脚本体验项目功能!</p>
|
||||||
|
<p>用户脚本链接(右键单击复制链接):<a href="https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/refs/heads/master/static/XHS-Downloader.js">master 分支</a>、<a href="https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/refs/heads/develop/static/XHS-Downloader.js">develop 分支</a></p>
|
||||||
<img src="static/screenshot/脚本安装教程.png" alt="">
|
<img src="static/screenshot/脚本安装教程.png" alt="">
|
||||||
<hr>
|
<hr>
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
@ -238,7 +238,8 @@ async def example_api():
|
|||||||
<li>To prevent high-frequency requests from impacting the platform's servers, this project includes a built-in request delay mechanism</li>
|
<li>To prevent high-frequency requests from impacting the platform's servers, this project includes a built-in request delay mechanism</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h1 id="user-scripts">🕹 User Script</h1>
|
<h1 id="user-scripts">🕹 User Script</h1>
|
||||||
<p>If your browser has the <a href="https://www.tampermonkey.net/">Tampermonkey</a> browser extension installed, you can add the <a href="https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/master/static/XHS-Downloader.js">user script</a>(Right click to copy link) to experience the project features without needing to download or install anything!</p>
|
<p>If your browser has the <a href="https://www.tampermonkey.net/">Tampermonkey</a> extension installed, you can use the userscript to try the project's features!</p>
|
||||||
|
<p>Userscript links (right-click to copy the link): <a href="https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/refs/heads/master/static/XHS-Downloader.js">master branch</a>, <a href="https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/refs/heads/develop/static/XHS-Downloader.js">develop branch</a></p>
|
||||||
<img src="static/screenshot/脚本安装教程.png" alt="">
|
<img src="static/screenshot/脚本安装教程.png" alt="">
|
||||||
<hr>
|
<hr>
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
**用户脚本更新内容:**
|
**用户脚本更新内容:**
|
||||||
|
|
||||||
**版本号:2.1.11**
|
**版本号:2.1.12**
|
||||||
|
|
||||||
1. 修复合辑作品链接提取失败的问题
|
1. 新增链接提取/图片下载选择模式开关
|
||||||
|
2. 修复合辑作品链接提取失败的问题
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name XHS-Downloader
|
// @name XHS-Downloader
|
||||||
// @namespace https://github.com/JoeanAmier/XHS-Downloader
|
// @namespace https://github.com/JoeanAmier/XHS-Downloader
|
||||||
// @version 2.1.11
|
// @version 2.1.12
|
||||||
// @description 提取小红书作品/用户链接,下载小红书无水印图文/视频作品文件
|
// @description 提取小红书作品/用户链接,下载小红书无水印图文/视频作品文件
|
||||||
// @author JoeanAmier
|
// @author JoeanAmier
|
||||||
// @match http*://xhslink.com/*
|
// @match http*://xhslink.com/*
|
||||||
@ -34,6 +34,8 @@
|
|||||||
autoScrollSwitch: GM_getValue("autoScrollSwitch", false),
|
autoScrollSwitch: GM_getValue("autoScrollSwitch", false),
|
||||||
maxScrollCount: GM_getValue("maxScrollCount", 50),
|
maxScrollCount: GM_getValue("maxScrollCount", 50),
|
||||||
keepMenuVisible: GM_getValue("keepMenuVisible", false),
|
keepMenuVisible: GM_getValue("keepMenuVisible", false),
|
||||||
|
linkCheckboxSwitch: GM_getValue("linkCheckboxSwitch", true),
|
||||||
|
imageCheckboxSwitch: GM_getValue("imageCheckboxSwitch", true),
|
||||||
fileNameFormat: undefined,
|
fileNameFormat: undefined,
|
||||||
imageFileFormat: undefined,
|
imageFileFormat: undefined,
|
||||||
icon: {
|
icon: {
|
||||||
@ -144,6 +146,16 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateLinkCheckboxSwitch = (value) => {
|
||||||
|
config.linkCheckboxSwitch = value;
|
||||||
|
GM_setValue("linkCheckboxSwitch", config.linkCheckboxSwitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateImageCheckboxSwitch = (value) => {
|
||||||
|
config.imageCheckboxSwitch = value;
|
||||||
|
GM_setValue("imageCheckboxSwitch", config.imageCheckboxSwitch);
|
||||||
|
}
|
||||||
|
|
||||||
const updateFileNameFormat = (value) => {
|
const updateFileNameFormat = (value) => {
|
||||||
config.fileNameFormat = value;
|
config.fileNameFormat = value;
|
||||||
GM_setValue("fileNameFormat", config.fileNameFormat);
|
GM_setValue("fileNameFormat", config.fileNameFormat);
|
||||||
@ -232,7 +244,7 @@
|
|||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
console.error("解析图文作品数据失败", note)
|
console.error("解析图文作品数据失败", note)
|
||||||
abnormal("解析图文作品数据发生异常!")
|
abnormal("解析图文作品数据发生异常!")
|
||||||
} else if (urls.length > 1) {
|
} else if (urls.length > 1 && config.imageCheckboxSwitch) {
|
||||||
showImageSelectionModal(items, name,)
|
showImageSelectionModal(items, name,)
|
||||||
} else {
|
} else {
|
||||||
showToast("正在下载文件,请稍等...");
|
showToast("正在下载文件,请稍等...");
|
||||||
@ -560,14 +572,19 @@
|
|||||||
urlsString = generateUserUrls(data);
|
urlsString = generateUserUrls(data);
|
||||||
callback(urlsString);
|
callback(urlsString);
|
||||||
} else {
|
} else {
|
||||||
showListSelectionModal(data.map(([id, token, cover, author, title,]) => ({
|
if (config.linkCheckboxSwitch) {
|
||||||
id: id, token: token, image: cover, author: author, title: title,
|
showListSelectionModal(data.map(([id, token, cover, author, title,]) => ({
|
||||||
})),).then((selected) => {
|
id: id, token: token, image: cover, author: author, title: title,
|
||||||
if (selected.length > 0) {
|
})),).then((selected) => {
|
||||||
urlsString = generateNoteUrls(selected.map(item => [item.id, item.token]));
|
if (selected.length > 0) {
|
||||||
callback(urlsString);
|
urlsString = generateNoteUrls(selected.map(item => [item.id, item.token]));
|
||||||
}
|
callback(urlsString);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
urlsString = generateNoteUrls(data.map(item => [item.id, item.token]))
|
||||||
|
callback(urlsString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [0, 1, 2, 5].includes(order))
|
}, [0, 1, 2, 5].includes(order))
|
||||||
};
|
};
|
||||||
@ -998,6 +1015,18 @@
|
|||||||
disabled: !GM_getValue("autoScrollSwitch", false),
|
disabled: !GM_getValue("autoScrollSwitch", false),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const linkCheckboxSwitch = createSettingItem({
|
||||||
|
label: '链接提取选择模式',
|
||||||
|
description: '关闭后,提取作品链接时无需确认直接提取全部链接',
|
||||||
|
checked: GM_getValue("linkCheckboxSwitch", true),
|
||||||
|
});
|
||||||
|
|
||||||
|
const imageCheckboxSwitch = createSettingItem({
|
||||||
|
label: '图片下载选择模式',
|
||||||
|
description: '关闭后,下载图文作品时无需确认直接下载全部文件',
|
||||||
|
checked: GM_getValue("imageCheckboxSwitch", true),
|
||||||
|
});
|
||||||
|
|
||||||
const keepMenuVisible = createSettingItem({
|
const keepMenuVisible = createSettingItem({
|
||||||
label: '菜单保持显示',
|
label: '菜单保持显示',
|
||||||
description: '启用后,功能菜单无需鼠标悬停始终保持显示',
|
description: '启用后,功能菜单无需鼠标悬停始终保持显示',
|
||||||
@ -1022,6 +1051,8 @@
|
|||||||
body.appendChild(filePack);
|
body.appendChild(filePack);
|
||||||
body.appendChild(autoScroll);
|
body.appendChild(autoScroll);
|
||||||
body.appendChild(scrollCount);
|
body.appendChild(scrollCount);
|
||||||
|
body.appendChild(linkCheckboxSwitch);
|
||||||
|
body.appendChild(imageCheckboxSwitch);
|
||||||
body.appendChild(keepMenuVisible);
|
body.appendChild(keepMenuVisible);
|
||||||
// body.appendChild(nameFormat);
|
// body.appendChild(nameFormat);
|
||||||
|
|
||||||
@ -1049,6 +1080,8 @@
|
|||||||
updateAutoScrollSwitch(autoScroll.querySelector('input').checked);
|
updateAutoScrollSwitch(autoScroll.querySelector('input').checked);
|
||||||
updatePackageDownloadFiles(filePack.querySelector('input').checked);
|
updatePackageDownloadFiles(filePack.querySelector('input').checked);
|
||||||
updateKeepMenuVisible(keepMenuVisible.querySelector('input').checked);
|
updateKeepMenuVisible(keepMenuVisible.querySelector('input').checked);
|
||||||
|
updateLinkCheckboxSwitch(linkCheckboxSwitch.querySelector('input').checked);
|
||||||
|
updateImageCheckboxSwitch(imageCheckboxSwitch.querySelector('input').checked);
|
||||||
updateMaxScrollCount(parseInt(scrollCount.querySelector('input').value) || 50)
|
updateMaxScrollCount(parseInt(scrollCount.querySelector('input').value) || 50)
|
||||||
// updateFileNameFormat(nameFormat.querySelector('.text-input').value.trim() || null);
|
// updateFileNameFormat(nameFormat.querySelector('.text-input').value.trim() || null);
|
||||||
closeSettingsModal();
|
closeSettingsModal();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user