←用户:PandaFiredoge/文件2.js因为以下原因,您没有权限编辑该页面: 您请求的操作仅限属于这些用户组的用户执行:用户、管理员、行政员、editor您没有权限编辑此JavaScript页面,因为此页面包含另一位用户的个人设置。 您可以查看和复制此页面的源代码。 (async function fetchAllFilesDirectUrl() { const scriptPath = mw.config.get('wgScriptPath') || ''; const apiEndpoint = `${window.location.origin}${scriptPath}/api.php`; const redirectBaseUrl = `${window.location.origin}${scriptPath}/wiki/Special:%E9%87%8D%E5%AE%9A%E5%90%91/file?wpvalue=`; let urlList = []; let apcontinue = ''; console.log('开始获取并生成文件下载链接...'); do { const params = new URLSearchParams({ action: 'query', list: 'allpages', apnamespace: '6', // File 命名空间 aplimit: 'max', format: 'json', origin: '*' }); if (apcontinue) { params.append('apcontinue', apcontinue); } try { const response = await fetch(`${apiEndpoint}?${params.toString()}`); const data = await response.json(); if (data.query && data.query.allpages) { // 直接在获取时拼好完整 Redirect URL const urls = data.query.allpages.map(page => `${redirectBaseUrl}${encodeURIComponent(page.title)}`); urlList.push(...urls); console.log(`已处理 ${urlList.length} 个文件链接...`); } apcontinue = data.continue ? data.continue.apcontinue : null; } catch (error) { console.error('获取失败:', error); break; } } while (apcontinue); console.log(`✅ 完成!生成了 ${urlList.length} 个下载链接。`); // 直接导出拼好的 URL 列表,开箱即用 const blob = new Blob([urlList.join('\n')], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'fdm_download_links.txt'; a.click(); URL.revokeObjectURL(url); })(); 返回用户:PandaFiredoge/文件2.js。