function isAliyunDiskLinkValid(link) { return fetch(link, { method: 'HEAD' }) .then(response => { if (response.status === 200) { return true; } else { return false; } }) .catch(error => { console.error('Error fetching the link:', error); return false; }); } // 调用方法 const aliyunDiskLink = '替换为你的阿里云盘分享链接'; isAliyunDiskLinkValid(aliyunDiskLink).then(isValid => { console.log(isValid ? '链接有效' : '链接无效'); });
