1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
   |  <style> .post-title, h1.entry-title {     text-align: center; }
  .container {   max-width:800px;   margin:0 auto;   padding:20px;   font-family:'Noto Sans SC',sans-serif; } .card {   background: var(--card-bg, #fff);   color: var(--text-color, #212529);   border-radius:10px;   padding:20px;   box-shadow:0 4px 6px rgba(0,0,0,.1);   margin-bottom:20px; } .input-group {   display:flex;   margin-bottom:20px; } .input-group input {   flex:1;   padding:10px;   border-radius:4px 0 0 4px;   outline:none;   background: var(--input-bg, #fff);   color: var(--text-color, #212529);   border:1px solid var(--border-color, #ddd); } .input-group button {   padding:0 15px;   background: var(--primary-color, #4361ee);   color: var(--button-text-color, #fff);   border:none;   border-radius:0 4px 4px 0;   cursor:pointer; }
 
  .result-box {   background: var(--card-bg, #fff);   border-radius:10px;   padding:20px;   box-shadow:0 4px 6px rgba(0,0,0,.1);   margin-top:20px;   word-break: break-all; }
 
  .url-container {   display:flex;   margin:15px 0 10px 0;   flex-wrap: wrap;   gap: 5px; } .url-input {   flex:1;   padding:8px;   border:1px solid var(--border-color, #ddd);   border-right:none;   outline:none;   background: var(--input-bg, #f8f9fa);   color: var(--text-color, #212529);   min-width: 200px; } .copy-btn {   padding:0 10px;   background: var(--primary-color, #4cc9f0);   color: var(--button-text-color, #fff);   border:none;   cursor:pointer;   display:flex;   align-items:center;   margin-left:5px;   white-space: nowrap; } .copy-btn.md { background: var(--secondary-color, #6c757d); } .copy-btn.html { background: var(--dark-color, #495057); }
 
  .image-preview {   display: none;    justify-content: center;   align-items: center;   margin-top: 20px; } .image-preview img {   max-width: 100%;      height: auto;         border-radius: 10px;   box-shadow: 0 4px 6px rgba(0,0,0,.1);   pointer-events: none;   user-select: none;   -webkit-user-drag: none;    -khtml-user-drag: none;   -moz-user-drag: none;   -o-user-drag: none;   user-drag: none; }
  @media (max-width: 768px) {   .container {     padding:10px;   }   .url-container {     flex-direction: column;   }   .url-input {     border-right:1px solid var(--border-color, #ddd);     border-radius:4px;     margin-bottom:5px;   }   .copy-btn {     margin-left:0;     border-radius:4px;     justify-content: center;   }   .image-preview img {     width: 90%;   } }
  @keyframes spin {   0% { transform: rotate(0deg);}   100% { transform: rotate(360deg);} }
  #toastContainer {   position: fixed;   top: 100px;   left: 50%;   transform: translateX(-50%);   z-index: 9999; } .toast {   display: inline-block;   padding: 10px 20px;   border-radius: 50px;   margin-top: 10px;   font-size: 14px;   opacity: 0;   backdrop-filter: blur(10px);   background: rgba(255, 255, 255, 0.2);    animation: fadein 0.3s forwards, fadeout 0.3s forwards 4s;  }
  .toast.success { color: #28a745; }  .toast.error { color: #dc3545; }   @keyframes fadein {   from {opacity: 0; transform: translateY(-10px);}   to {opacity: 1; transform: translateY(0);} } @keyframes fadeout {   from {opacity: 1;}   to {opacity: 0;} } </style>
  <h1 style="text-align:center;">微云直链提取</h1>
 
  <div id="toastContainer"></div>
  <div class="container">   <div class="card">     <div class="input-group">       <input type="text" id="weiyunUrl" placeholder="输入微云分享链接(例如:https://share.weiyun.com/xxxxxxxx)">       <button onclick="extractImage()">提取图片</button>     </div>   </div>
    <div id="result"></div>
    <div class="image-preview" id="imagePreview">     <img id="previewImg" src="" alt="">   </div> </div>
  <script> const REFRESH_TIMES = 2; const INTERVAL = 10; let currentImageUrl = '';
  async function extractImage() {   const url = document.getElementById('weiyunUrl').value.trim();   if(!url){      showToast('❗️ 请输入微云分享链接', 'error');     return;    }   if(!url.includes('share.weiyun.com')) {     showToast('❗️ 请输入正确的微云分享链接', 'error');     return;   }
    try {     showLoading();     const res = await fetch('https://api.allorigins.win/get?url=' + encodeURIComponent(url));     const data = await res.json();     const html = data.contents;
      const match = html.match(/window\.syncData\s*=\s*({.+?});/s);     if(!match){ throw '❗️ 未找到图片信息,请检查链接是否正确'; }          const syncData = JSON.parse(match[1]);     const file = syncData.shareInfo.file_list[0];     if(!file){ throw '❗️ 未找到文件信息,该链接可能已失效'; }
      let previewUrl = file.https_thumb_url || file.thumb_url;     if(previewUrl.indexOf('size=')===-1){         previewUrl += (previewUrl.indexOf('?')===-1?'?':'&') + 'size=1000';     }     currentImageUrl = previewUrl;
      document.getElementById('result').innerHTML = `       <div class="result-box">         <p><strong>📝 文件名:</strong> ${file.file_name}</p>         <p><strong>⚖️ 大小:</strong> ${(file.file_size/1024/1024).toFixed(2)} MB</p>         <p><strong>🔤 格式:</strong> ${file.file_name.split('.').pop().toUpperCase()}</p>
          <div class="url-container">           <input class="url-input" value="${previewUrl}" readonly id="imageUrl">           <button class="copy-btn" onclick="copyToClipboard()">复制链接</button>           <button class="copy-btn md" onclick="copyMarkdown()">Markdown</button>           <button class="copy-btn html" onclick="copyHtml()">HTML</button>         </div>       </div>     `;
      const previewImg = document.getElementById('previewImg');     const imagePreview = document.getElementById('imagePreview');     imagePreview.style.display = 'flex';     previewImg.alt = file.file_name;
      previewImg.addEventListener('click', e => e.stopPropagation());     imagePreview.addEventListener('click', e => e.stopPropagation());
      for (let i = 0; i < REFRESH_TIMES; i++) {       setTimeout(() => {         previewImg.src = previewUrl + "&_t" + i + "=" + Date.now();       }, i * INTERVAL);     }
    } catch(e){     document.getElementById('result').innerHTML = `       <div class="result-box" style="color:red;">         <strong>‼️ 错误:</strong> ${e}         <p style="margin-top:10px;font-size:14px;">❗️ 请检查:</p>         <ul style="margin:5px 0;padding-left:20px;">           <li>❓ 链接是否正确</li>           <li>❓ 链接是否已过期</li>           <li>❓ 网络连接是否正常</li>         </ul>       </div>`;     document.getElementById('imagePreview').style.display = 'none';     showToast('🚫 提取图片失败', 'error');   } }
  function copyToClipboard(){   const input = document.getElementById('imageUrl');   input.select();   document.execCommand('copy');   showToast('✅ 已复制图片地址到剪贴板', 'success'); }
  function copyMarkdown(){   const input = document.getElementById('imageUrl');   const text = ``;   navigator.clipboard.writeText(text);   showToast('✅ 已复制 Markdown 格式到剪贴板', 'success'); }
  function copyHtml(){   const input = document.getElementById('imageUrl');   const text = `<img src="${input.value}" alt="图片">`;   navigator.clipboard.writeText(text);   showToast('✅ 已复制 HTML 格式到剪贴板', 'success'); }
  function showLoading() {   document.getElementById('result').innerHTML = `     <div class="result-box" style="text-align:center;">       <div style="display:inline-block;width:20px;height:20px;border:2px solid #f3f3f3;border-top:2px solid #4361ee;border-radius:50%;animation:spin 1s linear infinite;"></div>       <p style="margin-top:10px;">正在提取图片链接...</p>     </div>   `; }
 
  function showToast(message, type='success') {   const container = document.getElementById('toastContainer');   const toast = document.createElement('div');   toast.className = 'toast ' + (type==='success'?'success':'error');   toast.textContent = message;   container.appendChild(toast);
    setTimeout(() => {     toast.remove();   }, 4000);  }
 
  document.getElementById('weiyunUrl').addEventListener('keypress', function(e) {   if(e.key === 'Enter') {     extractImage();   } }); </script>
 
  |