From ba27edf2071d4373319416dd9effeb7db3e06bec Mon Sep 17 00:00:00 2001 From: baiiylu <62942942+zsbai@users.noreply.github.com> Date: Sun, 13 Apr 2025 05:42:57 +0800 Subject: [PATCH] feat: get download_link directly form weixin release website --- scripts/destVersionForMac.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/destVersionForMac.sh b/scripts/destVersionForMac.sh index 56f249c..302e2df 100644 --- a/scripts/destVersionForMac.sh +++ b/scripts/destVersionForMac.sh @@ -6,7 +6,8 @@ set -eo pipefail # 配置变量 # ==================================================== TEMP_PATH="WeChatMac/temp" -DOWNLOAD_LINK="${1:-https://dldir1.qq.com/weixin/mac/WeChatMac.dmg}" +WEBSITE_URL="https://mac.weixin.qq.com/?t=mac&lang=zh_CN" +DOWNLOAD_LINK="" # ==================================================== # 函数定义 @@ -41,15 +42,17 @@ echo_color() { # 安装依赖项 install_depends() { print_separator - echo_color "yellow" "Installing dependencies: 7zip, wget, curl, git, gh, dmg2img, shasum" + echo_color "yellow" "Installing dependencies: 7zip, wget, curl, git, gh, dmg2img, shasum, pup" print_separator sudo apt update - sudo apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git gh dmg2img + sudo apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git gh dmg2img pup } # 下载 WeChat DMG download_wechat() { + DOWNLOAD_LINK=$(curl -s "$WEBSITE_URL" | pup 'a.download-button:nth-of-type(1) attr{href}') + print_separator echo_color "yellow" "Downloading the newest WeChatMac..." print_separator