Skip to content

Commit

Permalink
Merge pull request #114 from putyy/dev
Browse files Browse the repository at this point in the history
win7支持
  • Loading branch information
putyy authored Dec 4, 2024
2 parents fd89b71 + 8756e53 commit d9259bb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 70 deletions.
47 changes: 12 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
### 爱享素材下载器【[加入群聊](https://qm.qq.com/q/mfDMSpCxQ4)
🎯 基于 [electron-vite-vue](https://github.com/electron-vite/electron-vite-vue.git)
📦 操作简单、可获取不同类型的资源
🖥️ 支持Win10、Win11、Mac、Linux
🌐 支持视频、音频、图片、m3u8、直播流等常见网络资源拦截
🖥️ 支持Windows、Mac、Linux
🌐 支持视频、音频、图片、m3u8、直播流等常见网络资源
💪 支持微信视频号、小程序、抖音、快手、小红书、酷狗音乐、qq音乐等网络资源下载
👼 支持设置代理以获取特殊网络下的资源

Expand All @@ -12,29 +12,26 @@
🆕 [蓝奏云下载 密码:9vs5](https://wwjv.lanzoum.com/b04wgtfyb)

## 使用方法
> 0. 安装一定要同意安装证书文件,安装一定要同意安装证书文件,安装一定要同意安装证书文件!
> 1. 打开本软件
> 2. 软件首页选择要获取的资源类型(默认选中的视频
> 0. 安装时一定要同意安装证书文件、使用时一定要允许网络访问
> 1. 打开本软件 软件首页左上角点击 “启动代理”
> 2. 软件首页选择要获取的资源类型(默认选中的全部
> 3. 打开要捕获的源, 如:视频号、网页、小程序等等
> 4. 返回软件首页即可看到资源列表
## 软件截图
![](public/show.webp)

## 常见问题
m3u8预览和下载
m3u8: 预览和下载
> [下载](https://m3u8-down.gowas.cn/) [预览](https://m3u8play.com/)
直播流 预览和录制:
> [使用obs进行预览和录制]( https://obsproject.com/)
直播流: 预览和录制:
> [使用obs进行预览和录制 使用教程自行百度]( https://obsproject.com/)
下载慢、大视频下载失败(最新版本以内置aria2下载器)
下载慢、大视频下载失败(最新版本已内置aria2下载器)
> 推荐使用如下工具加速下载,视频号可以下载完成后再到对应视频操作项选择 “视频解密(视频号)” 按钮
>> [Neat Download Manager](https://www.neatdownloadmanager.com/index.php/en/)[Motrix](https://motrix.app/download)等软件进行下载
Win7无法使用
> 软件不支持,也无计划支持
打开本软件,无法正常拦截获取
> 检查系统代理是否正确设置 代理地址:127.0.0.1 端口:8899
Expand All @@ -43,34 +40,14 @@ Win7无法使用
打开本软件后无法上网
> 手动删除安装标识锁文件,之后再打开软件会进行检查证书是否正确安装
>> MAC: /Users/你的用户名称/.res-downloader@putyy/res-downloader-installed.lock
>> MAC: /Users/你的用户名称/.res-downloader@putyy/res-downloader-installed.lock
>
>> Win: C:\Users\Admin\.res-downloader@putyy/res-downloader-installed.lock
其他问题
[github](https://github.com/putyy/res-downloader/issues)[爱享论坛](https://s.gowas.cn/d/4089)

## 二次开发
> ps: 打包慢的问题可以参考 https://www.putyy.com/articles/87
```sh
git clone https://github.com/putyy/res-downloader

cd res-downloader

yarn install

yarn run dev

# 打包mac
yarn run build --universal --mac

# 打包win
yarn run build --win

# 打包linux
yarn run build --linux
```

## 实现&初衷
## 实现 & 初衷
通过代理网络抓包拦截响应,筛选出有用的资源, 同fiddler、charles等抓包软件、浏览器F12打开控制也能达到目的,只不过这些软件需要手动进行筛选,对于小白用户上手还是有点难度,本软件对部分资源做了特殊处理,更适合大众用户,所以就有了本项目。

## 免责声明
Expand Down
16 changes: 5 additions & 11 deletions electron/main/aria2Rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ export class Aria2RPC {
}

calculateDownloadProgress(bitfield) {
// 将十六进制的 bitfield 转换为二进制字符串
const totalPieces = bitfield.length * 4; // 每个十六进制字符对应 4 位
const binaryString = bitfield.split('').map(hex => parseInt(hex, 16).toString(2).padStart(4, '0')).join('');

// 计算已下载的部分数
const downloadedPieces = binaryString.split('').filter(bit => bit === '1').length;

// 计算进度百分比
const progressPercentage = (downloadedPieces / totalPieces) * 100;

return progressPercentage.toFixed(2); // 保留两位小数
const totalPieces = bitfield.length * 4
const binaryString = bitfield.split('').map(hex => parseInt(hex, 16).toString(2).padStart(4, '0')).join('')
const downloadedPieces = binaryString.split('').filter(bit => bit === '1').length
const progressPercentage = (downloadedPieces / totalPieces) * 100
return progressPercentage.toFixed(2)
}
}
2 changes: 2 additions & 0 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ global.resdConfig = {
}

// app.whenReady().then(createWindow)
// 修复部分机型GPU主窗口空白错误
app.disableHardwareAcceleration();

app.on('window-all-closed', () => {
mainWindow = null
Expand Down
21 changes: 3 additions & 18 deletions electron/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,6 @@ export default function initIPC() {
});
return false
}
// let upstream_proxy = ""
// if (arg.upstream_proxy && !arg.upstream_proxy.includes(':8899')) {
// upstream_proxy = arg.upstream_proxy
// }
//
// global.isStartProxy = true
// return startServer({
// win: win,
// upstreamProxy: upstream_proxy,
// setProxyErrorCallback: err => {
// console.log('setProxyErrorCallback', err)
// },
// })
})

ipcMain.handle('invoke_select_down_dir', async (event, arg) => {
Expand Down Expand Up @@ -107,12 +94,10 @@ export default function initIPC() {
}
if (quality === "0" && data.decode_key) {
const urlInfo = urlTool.parse(down_url, true);
console.log('urlInfo', urlInfo)
if (urlInfo.query["token"] && urlInfo.query["encfilekey"]) {
down_url = urlInfo.protocol + "//" + urlInfo.hostname + urlInfo.pathname.replace("251/20302", "251/20304") +
"?encfilekey=" + urlInfo.query["encfilekey"] +
"&token=" + urlInfo.query["token"]
console.log("down_url:", down_url)
}
} else if (quality !== "-1" && data.decode_key && data.file_format) {
const format = data.file_format.split('#');
Expand Down Expand Up @@ -158,7 +143,7 @@ export default function initIPC() {
})
resolve(res)
}).catch((error) => {
console.log("err:", error)
console.log("decodeWxFile err:", error)
resolve(false);
})
} else {
Expand All @@ -168,13 +153,13 @@ export default function initIPC() {
}
}
}).catch((error) => {
console.error(error)
console.log("aria2RpcClient err:", error)
clearInterval(progressIntervalId)
resolve(false)
});
}, 1000)
}).catch((error) => {
console.log("err:", error)
console.log("aria2RpcClient.addUri err:", error)
resolve(false)
});
});
Expand Down
3 changes: 1 addition & 2 deletions electron/main/proxyServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export function startServer(win) {
if (global.resdConfig.proxy && !global.resdConfig.proxy.includes(':' + global.resdConfig.port)) {
upstreamProxy = global.resdConfig?.proxy
}
console.log("global.resdConfig.port:", global.resdConfig.port)
const proxy = hoXy.createServer({
upstreamProxy: upstreamProxy,
certAuthority: {
Expand All @@ -54,7 +53,7 @@ export function startServer(win) {
})
intercept(proxy, win)
} catch (e) {
console.error("--------------proxy catch err--------------");
console.error("--------------proxy catch err--------------", e);
}
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "res-downloader",
"version": "2.2.0",
"version": "2.3.0",
"main": "dist-electron/main/index.js",
"description": "res-downloader(爱享素材下载器),支持视频号、小程序、抖音、快手、小红书、酷狗音乐、qq音乐、qq短视频等",
"homepage": "https://github.com/putyy/res-downloader",
Expand Down Expand Up @@ -32,8 +32,8 @@
"@vitejs/plugin-vue": "^4.3.3",
"cross-spawn": "^7.0.3",
"crypto-js": "^4.1.1",
"electron": "^26.0.0",
"electron-builder": "^24.6.3",
"electron": "^22.3.27",
"electron-builder": "^23.6.0",
"electron-is-dev": "^2.0.0",
"electron-log": "^4.4.8",
"element-plus": "^2.3.12",
Expand Down
Binary file modified public/show.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/views/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const selectSaveDir = () => {
}
const onSetting = () => {
localStorageCache.set("resd_config", JSON.stringify(formData.value))
localStorageCache.set("resd_config", JSON.stringify(formData.value), -1)
ipcRenderer.invoke('invoke_set_config', Object.assign({}, formData.value))
if (proxy_old.value != formData.value.proxy || port_old.value != formData.value.port){
ipcRenderer.invoke('invoke_window_restart')
Expand Down

0 comments on commit d9259bb

Please sign in to comment.