<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>DBD-博客</title>
  <language>zh-cn</language>
  <generator>microfeed.org</generator>
  <itunes:type>episodic</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://my-microfeed.z2326173351-8c6.workers.dev/rss/" type="application/rss+xml"/>
  <link>https://my-microfeed.z2326173351-8c6.workers.dev</link>
  <description>
    <![CDATA[<style>
        #api-text-container {
            font-size: 20px;
            max-width: 100%;
            text-align: center;
            line-height: 1.6;
            padding: 20px;
            border-left: 4px solid #4CAF50;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
@media (max-width: 768px) {
            #api-text-container {
                font-size: 19px; /* 移动端减小到18px */
                max-width: 100%; /* 移动端宽度占比更大（减少留白） */
                padding: 15px; /* 移动端内边距减小 */
            }
    </style>
<p id="api-text-container"></p>
<script>
  // 调用文字API（以「一言」为例，返回随机句子）
  fetch("https://v1.hitokoto.cn/?c=d") // API地址（返回JSON）
    .then(response => response.json())
    .then(data => {
      // 将API返回的文字填入容器（不添加任何样式，使用网站默认文本样式）
      document.getElementById("api-text-container").textContent = data.hitokoto;
    })
    .catch(error => {
      // 加载失败时显示提示（同样使用默认样式）
      document.getElementById("api-text-container").textContent = "加载失败，请稍后刷新";
    });
</script>
<p>这是一款轻量级的内容管理系统（CMS），可自行托管于Cloudflare平台。通过microfeed，您能够便捷地发布多种形式的内容——包括音频、视频、照片、文档、博客文章及外部链接，并以网页、RSS订阅和JSON格式输出信息流。</p>]]>
  </description>
  <itunes:author>DBD制作组</itunes:author>
  <itunes:image href="https://my-microfeed.z2326173351-8c6.workers.dev/assets/default/channel-image.png"/>
  <image>
    <title>DBD-博客</title>
    <url>https://my-microfeed.z2326173351-8c6.workers.dev/assets/default/channel-image.png</url>
    <link>https://my-microfeed.z2326173351-8c6.workers.dev</link>
  </image>
  <copyright>©2026</copyright>
  <item>
    <title>随机API视频源 - 合集</title>
    <guid>SDoUvsaQnJH</guid>
    <pubDate>Thu, 17 Sep 2026 07:34:21 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<p>下面数据提取自：<a href="https://shuaya.pages.dev/" rel="noopener noreferrer" target="_blank">刷鸭</a></p><p>const MMApi = (() =&gt; {</p><p>// 视频源列表：title 即博主昵称</p><p>const _apiList = [{</p><p>code: "003", title: '高质量纯妹',</p><p>apiData: { api: 'http://api.yujn.cn/api/zzxjj.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "001", title: '黑丝',</p><p>apiData: { api: 'https://api.yujn.cn/api/heisis.php?type=video', data: '', type: 'link' }</p><p>}, {</p><p>code: "002", title: '萌妹短视频',</p><p>apiData: { api: 'https://api.yujn.cn/api/nvda.php?type=video', data: '', type: 'link' }</p><p>}, {</p><p>code: "005", title: '清纯萝莉',</p><p>apiData: { api: 'http://api.yujn.cn/api/zzxjj.php?temps=', data: '', type: 'random' },</p><p>}, {</p><p>code: "007", title: '快手扭一扭',</p><p>apiData: { api: 'http://v.nrzj.vip/video.php?_t=', data: '', type: 'random' },</p><p>}, {</p><p>code: "009", title: '妹纸',</p><p>apiData: { api: 'http://v.nrzj.vip/video.php', data: '', type: 'link' },</p><p>}, {</p><p>code: "010", title: '清纯',</p><p>apiData: { api: 'http://api.yujn.cn/api/zzxjj.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "011", title: '甜妹',</p><p>apiData: { api: 'http://api.yujn.cn/api/xjj.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "018", title: '快手女大学生',</p><p>apiData: { api: 'https://api.yujn.cn/api/nvda.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "019", title: '黑丝系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/heisis.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "020", title: '慢摇系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/manyao.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "021", title: '吊带系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/diaodai.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "022", title: '清纯系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/qingchun.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "023", title: '女高系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/nvgao.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "024", title: '快手变装系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/ksbianzhuang.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "025", title: '甜妹系列',</p><p>apiData: { api: 'http://api.yujn.cn/api/tianmei.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "026", title: '欲梦视频',</p><p>apiData: { api: 'http://api.yujn.cn/api/ndym.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "027", title: '热舞视频',</p><p>apiData: { api: 'http://api.yujn.cn/api/rewu.php?type=video', data: '', type: 'link' },</p><p>}, {</p><p>code: "028", title: '小姐姐视频',</p><p>apiData: { api: 'http://api.yujn.cn/api/ksxjjsp.php', data: '', type: 'link' },</p><p>}, {</p><p>code: "031", title: '小姐姐',</p><p>apiData: { api: 'https://api.cenguigui.cn/api/mp4/MP4_xiaojiejie.php', data: '', type: 'link' }</p><p>}, {</p><p>code: "032", title: '高质量',</p><p>apiData: { api: 'https://api.lolimi.cn/API/xjj/xjj.php', data: '', type: 'link' }</p><p>}, {</p><p>code: "033", title: '随机小姐姐',</p><p>apiData: { api: 'https://v2.xxapi.cn/api/meinv', data: 'data', type: 'data' }</p><p>}, {</p><p>code: "034", title: '小姐姐',</p><p>apiData: { api: 'https://api.dwo.cc/api/ksvideo', data: '', type: 'link' }</p><p>}];</p>]]>
    </description>
    <link>https://cms.4km.qzz.io/i/api-SDoUvsaQnJH/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
  <item>
    <title>随机播放器 - 简易版</title>
    <guid>xAP2KEv6gm5</guid>
    <pubDate>Sun, 06 Sep 2026 20:55:51 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>随机跳舞视频播放器</title>
<style>
  /* ===== 性能优化：GPU 加速 & 最小化重绘 ===== */
  * { margin: 0; padding: 0; box-sizing: border-box; }
  :root {
    --bg: #0a0a0a;
    --accent: #ff2d95;
    --accent2: #7b2dff;
    --text: #fff;
    --radius: 14px;
  }
  //body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
  }

  /* ===== 播放器容器 ===== */
  .player-wrap {
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    background: #111;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    position: relative;
    /* contain 提示浏览器优化渲染 */
    contain: layout style paint;
  }

  /* ===== 视频区域 ===== */
  .video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    overflow: hidden;
  }
  .video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* 硬件加速 */
    transform: translateZ(0);
    will-change: auto;
  }

  /* 加载动画 */
  .loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,.75);
    z-index: 10;
    transition: opacity .3s;
    pointer-events: none;
  }
  .loader.hidden { opacity: 0; }
  .spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loader-text {
    color: rgba(255,255,255,.7);
    font-size: 13px;
    margin-top: 12px;
  }

  /* ===== 顶部信息栏 ===== */
  .top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 14px 16px 40px;
    background: linear-gradient(180deg, rgba(0,0,0,.6), transparent);
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .badge {
    background: rgba(255,45,149,.9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: .5px;
  }
  .api-indicator {
    font-size: 11px;
    color: rgba(255,255,255,.6);
    background: rgba(0,0,0,.4);
    padding: 4px 8px;
    border-radius: 6px;
  }

  /* ===== 控制栏 ===== */
  .controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 40px 14px 14px;
    background: linear-gradient(0deg, rgba(0,0,0,.75), transparent);
    z-index: 5;
    display: flex;
    gap: 10px;
    align-items: center;
  }
  .btn {
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
  }
  .btn:active { transform: scale(.92); }
  .btn:disabled { opacity(.4); cursor: not-allowed; }

  /* 刷新/切换按钮（主按钮） */
  .btn-refresh {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(255,45,149,.4);
  }
  .btn-refresh svg { width: 22px; height: 22px; fill: #fff; }
  .btn-refresh.spinning svg { animation: spin .7s linear infinite; }

  /* 播放/暂停 */
  .btn-play {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(10px);
    color: #fff;
    flex-shrink: 0;
  }
  .btn-play svg { width: 20px; height: 20px; fill: #fff; }

  /* 进度条 */
  .progress-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,.25);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    transition: width .1s linear;
  }

  /* 时间 */
  .time {
    font-size: 11px;
    color: rgba(255,255,255,.8);
    font-variant-numeric: tabular-nums;
    min-width: 42px;
    text-align: right;
  }

  /* ===== Toast 提示 ===== */
  .toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.8);
    background: rgba(0,0,0,.85);
    color: #fff;
    font-size: 14px;
    padding: 10px 22px;
    border-radius: 10px;
    z-index: 20;
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(8px);
  }
  .toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  /* ===== 错误状态 ===== */
  .error-state {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,.85);
    z-index: 15;
    color: #fff;
    text-align: center;
    padding: 20px;
  }
  .error-state.show { display: flex; }
  .error-state svg { width: 40px; height: 40px; fill: #ff4757; margin-bottom: 10px; }
  .error-state p { font-size: 14px; opacity: .8; margin-bottom: 14px; }
  .error-state button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
  }
</style>
</head>
<body>

<!--
=============================================
  可嵌入博客的用法：
  复制下面的代码片段直接粘贴到博客 HTML 中即可

  <iframe src="https://你的域名/dance-player.html" width="100%" height="700" frameborder="0" allowfullscreen></iframe>

  或者如果你想要自适应高度：
  <div style="max-width:480px;margin:0 auto;">
    <iframe src="dance-player.html" width="100%" height="750" frameborder="0" allow="autoplay; fullscreen" style="border-radius:14px;"></iframe>
  </div>
=============================================
-->
<br><br>
<div class="player-wrap" id="playerWrap"><!-- 视频容器 -->
  <div class="video-container"><video id="videoEl" playsinline loop preload="metadata"></video>

    <!-- 顶部栏 -->
    <div class="top-bar"><span class="badge">🔥 随机舞蹈</span>
      <span class="api-indicator" id="apiIndicator">API #1</span></div>
    <!-- 加载动画 -->
    <div class="loader" id="loader">
      <div class="spinner"></div>
      <div class="loader-text">正在加载视频...</div>
    </div>
    <!-- Toast -->
    <div class="toast" id="toast"></div>
    <!-- 错误状态 -->
    <div class="error-state" id="errorState"><svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>
      <p id="errorText">加载失败</p>
      <button onclick="player.fetchVideo()">重试</button>
    </div>
    <!-- 控制栏 -->
    <div class="controls"><button class="btn btn-play" id="playBtn" title="播放/暂停">
        <svg id="playIcon" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
        <svg id="pauseIcon" viewBox="0 0 24 24" style="display:none"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
      </button>
      <div class="progress-wrap" id="progressWrap">
        <div class="progress-bar" id="progressBar"></div>
      </div>
      <span class="time" id="timeEl">0:00</span>
      <button class="btn btn-refresh" id="refreshBtn" title="切换视频">
        <svg viewBox="0 0 24 24"><path d="M17.65 6.35A7.958 7.958 0 0012 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0112 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 9h7V2l-2.35 4.35z"/></svg>
      </button>
    </div>
  </div>
</div>
<script>
/* ============================================================
   高性能随机舞蹈视频播放器
   - 支持多个 API 切换（轮询 / 故障转移）
   - 视频预加载 & 缓存
   - 错误自动重试
   - 可嵌入博客（iframe 方式）
============================================================ */
(function () {
  'use strict';

  // ===== API 配置（可扩展多个） =====
  const API_ENDPOINTS = [
    'http://api.nonebot.top/api/v1/random/dance_video',
    // 在这里添加更多 API 地址实现故障转移：
    // 'http://api.nonebot.top/api/v1/random/dance_video',
  ];

  // ===== DOM 元素 =====
  const videoEl     = document.getElementById('videoEl');
  const loader      = document.getElementById('loader');
  const toast       = document.getElementById('toast');
  const errorState  = document.getElementById('errorState');
  const errorText   = document.getElementById('errorText');
  const refreshBtn  = document.getElementById('refreshBtn');
  const playBtn     = document.getElementById('playBtn');
  const playIcon    = document.getElementById('playIcon');
  const pauseIcon   = document.getElementById('pauseIcon');
  const progressBar = document.getElementById('progressBar');
  const progressWrap= document.getElementById('progressWrap');
  const timeEl      = document.getElementById('timeEl');
  const apiIndicator= document.getElementById('apiIndicator');

  // ===== 状态 =====
  let currentApiIndex = 0;
  let isLoading = false;
  let retryCount = 0;
  const MAX_RETRY = 2;
  // 简单缓存：避免短时间内重复同一个视频
  let lastVideoUrl = '';

  // ===== 工具函数 =====
  function showLoader(show) {
    loader.classList.toggle('hidden', !show);
  }

  function showToast(msg) {
    toast.textContent = msg;
    toast.classList.add('show');
    clearTimeout(toast._timer);
    toast._timer = setTimeout(() => toast.classList.remove('show'), 1500);
  }

  function formatTime(sec) {
    if (!sec || isNaN(sec)) return '0:00';
    const m = Math.floor(sec / 60);
    const s = Math.floor(sec % 60);
    return m + ':' + (s < 10 ? '0' : '') + s;
  }

  // ===== 核心：获取视频 =====
  async function fetchVideoUrl() {
    const apiUrl = API_ENDPOINTS[currentApiIndex];
    apiIndicator.textContent = 'API #' + (currentApiIndex + 1);

    try {
      const res = await fetch(apiUrl, {
        method: 'GET',
        headers: { 'Accept': 'application/json' },
        // 防止缓存导致一直拿到同一个视频
        cache: 'no-store'
      });

      if (!res.ok) throw new Error('HTTP ' + res.status);

      const json = await res.json();
      // 兼容不同返回格式
      const videoUrl = json.data || json.url || json.video_url || (json.result && json.result.url);

      if (!videoUrl) throw new Error('未获取到视频地址');

      return videoUrl;
    } catch (err) {
      console.warn('[DancePlayer] API 请求失败:', err.message);
      // 尝试切换到下一个 API
      if (currentApiIndex < API_ENDPOINTS.length - 1) {
        currentApiIndex++;
        return fetchVideoUrl(); // 递归尝试下一个
      }
      throw err;
    }
  }

  // ===== 加载并播放视频 =====
  async function loadVideo(isManualRefresh) {
    if (isLoading) return;
    isLoading = true;
    showLoader(true);
    errorState.classList.remove('show');
    if (isManualRefresh) {
      refreshBtn.classList.add('spinning');
    }

    try {
      let videoUrl = await fetchVideoUrl();

      // 如果跟上次一样，再请求一次（避免重复）
      if (videoUrl === lastVideoUrl && retryCount < MAX_RETRY) {
        retryCount++;
        videoUrl = await fetchVideoUrl();
      }
      retryCount = 0;
      lastVideoUrl = videoUrl;

      // 设置视频源
      videoEl.src = videoUrl;

      // 预加载元数据
      await new Promise((resolve, reject) => {
        const onLoaded = () => { cleanup(); resolve(); };
        const onError  = () => { cleanup(); reject(new Error('视频加载失败')); };
        function cleanup() {
          videoEl.removeEventListener('loadedmetadata', onLoaded);
          videoEl.removeEventListener('error', onError);
        }
        videoEl.addEventListener('loadedmetadata', onLoaded);
        videoEl.addEventListener('error', onError);
        // 超时保护
        setTimeout(() => { cleanup(); reject(new Error('加载超时')); }, 15000);
      });

      // 自动播放（移动端需要 muted，但这里是视频所以直接播）
      try {
        await videoEl.play();
      } catch (e) {
        console.info('[DancePlayer] 自动播放被阻止，等待用户交互');
      }

      showLoader(false);
      if (isManualRefresh) showToast('🎉 已切换新视频');

    } catch (err) {
      console.error('[DancePlayer] 加载失败:', err);
      showLoader(false);
      errorText.textContent = '网络异常，请检查连接';
      errorState.classList.add('show');
      if (isManualRefresh) showToast('❌ 加载失败');
    } finally {
      isLoading = false;
      refreshBtn.classList.remove('spinning');
    }
  }

  // ===== 事件绑定 =====

  // 刷新/切换按钮
  refreshBtn.addEventListener('click', function () {
    // 手动切换时轮转到下一个 API
    currentApiIndex = (currentApiIndex + 1) % API_ENDPOINTS.length;
    loadVideo(true);
  });

  // 播放/暂停
  playBtn.addEventListener('click', function () {
    if (videoEl.paused) {
      videoEl.play();
    } else {
      videoEl.pause();
    }
  });

  videoEl.addEventListener('play', function () {
    playIcon.style.display = 'none';
    pauseIcon.style.display = 'block';
  });
  videoEl.addEventListener('pause', function () {
    playIcon.style.display = 'block';
    pauseIcon.style.display = 'none';
  });

  // 进度条更新
  videoEl.addEventListener('timeupdate', function () {
    const pct = (videoEl.currentTime / videoEl.duration) * 100;
    progressBar.style.width = pct + '%';
    timeEl.textContent = formatTime(videoEl.currentTime);
  });

  // 点击进度条跳转
  progressWrap.addEventListener('click', function (e) {
    const rect = progressWrap.getBoundingClientRect();
    const pct = (e.clientX - rect.left) / rect.width;
    videoEl.currentTime = pct * videoEl.duration;
  });

  // 视频结束自动加载下一个
  videoEl.addEventListener('ended', function () {
    currentApiIndex = (currentApiIndex + 1) % API_ENDPOINTS.length;
    loadVideo(false);
  });

  // ===== 对外暴露 API（供父页面调用） =====
  window.DancePlayer = {
    refresh: function () { loadVideo(true); },
    play: function () { videoEl.play(); },
    pause: function () { videoEl.pause(); },
    setApi: function (index) {
      currentApiIndex = index % API_ENDPOINTS.length;
      loadVideo(true);
    }
  };

  // ===== 初始化 =====
  loadVideo(false);

})();
</script>
</body>]]>
    </description>
    <link>https://cms.4km.cc.cd/i/111-xAP2KEv6gm5/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
  <item>
    <title>随机小姐姐 - JSON版</title>
    <guid>tWOeugxry5W</guid>
    <pubDate>Sun, 06 Sep 2026 20:08:21 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机小姐姐</title>
    <style>
        //body {
            font-family: 'Arial', sans-serif;
            max-width: 1000px;
            margin: 0 auto;
            padding: 15px;
            background-color: #f5f5f5;
        }
        
        #player-container {
            background: #000;
            border-radius: 8px;
            margin-bottom: 15px;
            overflow: hidden;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        
        #player {
            width: 100%;
            height: auto;
            min-height: 545px;
            max-height: 550px;
            display: block;
        }
        
        .control-panel {
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-bottom: 15px;
        }
        
        .button-group {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }
        
        button {
            background: #7F9CCC;
            color: #fff;
            border: none;
            padding: 10px 12px;
            border-radius: 6px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            flex-grow: 1;
            font-size: 14px;
            min-width: 80px;
        }
        
        button:hover {
            background: #6A8BBC;
            transform: translateY(-1px);
        }
        
        button#toggleAuto {
            flex-grow: 2;
        }
        
        .source-management {
            margin-top: 15px;
        }
        
        .source-list {
            margin-top: 10px;
            max-height: 30vh;
            overflow-y: auto;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 8px;
        }
        
        .source-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px;
            border-bottom: 1px solid #eee;
        }
        
        .source-item:last-child {
            border-bottom: none;
        }
        
        .source-url {
            flex-grow: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-right: 8px;
            font-size: 14px;
        }
        
        .source-actions {
            display: flex;
            gap: 5px;
        }
        
        .source-actions button {
            padding: 5px 8px;
            font-size: 12px;
            background: #ff6b6b;
            min-width: 50px;
            flex-grow: 0;
        }
        
        .source-actions button:first-child {
            background: #4CAF50;
        }
        
        .add-source-form {
            display: flex;
            gap: 8px;
            margin-top: 12px;
        }
        
        .add-source-form input {
            flex-grow: 1;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }
        
        .add-source-form button {
            width: 90px;
            flex-grow: 0;
        }
        
        .status {
            margin-top: 10px;
            font-size: 14px;
            color: #666;
            text-align: center;
        }
        
        .current-source {
            font-weight: bold;
            color: #7F9CCC;
            word-break: break-all;
        }
        
        .default-source-indicator {
            color: #888;
            font-style: italic;
            margin-top: 5px;
        }
        
        @media (max-width: 600px) {
            body {
                padding: 10px;
            }
            #player {
                min-height: 540px;
            }
            .control-panel {
                padding: 12px;
            }
            button {
                padding: 8px 10px;
                font-size: 13px;
            }
            .source-item {
                flex-direction: column;
                align-items: flex-start;
            }
            .source-actions {
                margin-top: 5px;
                width: 100%;
                justify-content: flex-end;
            }
            .add-source-form {
                flex-direction: column;
            }
            .add-source-form button {
                width: 100%;
            }
        }
    </style>
</head>
<body>
<h1 style="text-align: center; margin-bottom: 15px;">随机小姐姐</h1>
<div id="player-container"><video id="player" controls playsinline></video></div>
<div class="control-panel">
  <div class="button-group">
            <button id="toggleAuto">连续播放: 开</button>
            <button id="nextVideo">换一个 ▶</button>
            <button id="switchSource">切换源</button>
  </div>
  <div class="status" id="statusArea"></div>
  <div class="source-management">
    <h3 style="margin-bottom: 8px;">视频源管理</h3>
    <div class="source-list" id="sourceList"></div>
    <div class="add-source-form">
            <input type="text" id="newSourceInput" placeholder="输入视频API地址">
            <button id="addSource">添加源</button>
    </div>
  </div>
</div>
<p>注意：这是一个JSON版随机视频播放器，部分浏览器播放失败或无法操作属于正常现象，更换浏览器尝试即可！跨域问题任未解决，但大部分能播放，点击按钮需等待。</p>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        // 默认视频源（已去重）
        const defaultSources = [
            'http://api.nonebot.top/api/v1/random/dance_video',
            'https://api.4qb.cn/api/suiji-sp?msg=%E7%83%AD%E8%88%9E&type=json'
        ];

        // 用户自定义源（本地持久化）
        let userSources = JSON.parse(localStorage.getItem('userVideoSources')) || [];

        // 合并全部源
        function getAllSources() {
            return [...userSources, ...defaultSources];
        }

        // 核心状态
        let currentSourceIndex = 0;
        let autoPlay = localStorage.getItem('autoPlay') !== 'false';
        let currentSourceRetries = 0;
        const maxRetriesPerSource = 2;
        let currentLoadToken = 0; // 任务编号，代替 isProcessing

        // DOM 元素
        const player = document.getElementById('player');
        const elements = {
            toggleAuto: document.getElementById('toggleAuto'),
            nextVideo: document.getElementById('nextVideo'),
            switchSource: document.getElementById('switchSource'),
            sourceList: document.getElementById('sourceList'),
            newSourceInput: document.getElementById('newSourceInput'),
            addSource: document.getElementById('addSource'),
            statusArea: document.getElementById('statusArea')
        };

        // 重置重试次数
        function resetSourceRetry() {
            currentSourceRetries = 0;
        }

        // 显示状态
        function showStatus(message, isError = false) {
            requestAnimationFrame(() => {
                elements.statusArea.innerHTML = `<div class="status-message" style="color: ${isError ? '#ff4444' : '#666'}">${message}</div>`;
            });
        }

        // 更新自动播放按钮
        function updateAutoPlayButton() {
            elements.toggleAuto.textContent = `连续播放: ${autoPlay ? '开' : '关'}`;
        }

        // 更新当前源显示
        function updateSourceDisplay() {
            const allSources = getAllSources();
            if (allSources.length === 0) {
                showStatus('无可用视频源，请添加视频源', true);
                return;
            }
            const currentSource = allSources[currentSourceIndex];
            const isDefaultSource = defaultSources.includes(currentSource);
            
            requestAnimationFrame(() => {
                if (isDefaultSource) {
                    elements.statusArea.innerHTML = `
                        <div class="status-message">正在使用系统默认视频源</div>
                        <div class="default-source-indicator">如需更好体验，请添加自定义视频源</div>
                    `;
                } else {
                    elements.statusArea.innerHTML = `
                        <div class="status-message">当前视频源:</div>
                        <div class="current-source">${currentSource}</div>
                    `;
                }
            });
        }

        // 从 API 返回内容中提取视频直链
        function extractVideoUrl(data) {
            if (typeof data === 'string') {
                const s = data.trim();
                if (/^https?:\/\/.+/i.test(s)) return s;
                try {
                    return extractVideoUrl(JSON.parse(s));
                } catch (e) {
                    return null;
                }
            }
            if (Array.isArray(data)) {
                for (const item of data) {
                    const url = extractVideoUrl(item);
                    if (url) return url;
                }
                return null;
            }
            if (data && typeof data === 'object') {
                const preferred = ['url', 'video', 'src', 'play_url', 'playUrl', 'dance_video', 'data', 'video_url', 'videourl'];
                for (const key of preferred) {
                    if (data[key] !== undefined && data[key] !== null) {
                        const url = extractVideoUrl(data[key]);
                        if (url) return url;
                    }
                }
                for (const key in data) {
                    if (Object.prototype.hasOwnProperty.call(data, key)) {
                        const url = extractVideoUrl(data[key]);
                        if (url) return url;
                    }
                }
            }
            return null;
        }

        // fetch 带超时控制
        async function fetchVideoUrl(apiUrl) {
            const timestamp = new Date().getTime();
            const randomParam = Math.random();
            let url = apiUrl;
            if (url.includes('?')) {
                url += `&_t=${timestamp}_${randomParam}`;
            } else {
                url += `?_t=${timestamp}_${randomParam}`;
            }

            const controller = new AbortController();
            const timeout = setTimeout(() => controller.abort(), 10000); // 10秒超时

            try {
                const response = await fetch(url, { cache: 'no-store', signal: controller.signal });
                if (!response.ok) throw new Error('HTTP ' + response.status);
                const type = response.headers.get('content-type') || '';
                if (type.startsWith('video/')) {
                    return response.url || apiUrl;
                }
                const text = await response.text();
                const videoUrl = extractVideoUrl(text);
                if (!videoUrl) throw new Error('未提取到视频地址');
                return videoUrl;
            } catch (err) {
                if (err.name === 'AbortError') {
                    throw new Error('请求超时(10s)');
                }
                throw err;
            } finally {
                clearTimeout(timeout);
            }
        }

        // 加载随机视频（使用任务编号，旧任务不会阻塞新任务）
        async function loadRandomVideo() {
            const myToken = ++currentLoadToken;

            const allSources = getAllSources();
            if (allSources.length === 0) {
                showStatus('无可用视频源，请添加视频源', true);
                return;
            }

            if (currentSourceIndex >= allSources.length) {
                currentSourceIndex = 0;
            }

            const currentSource = allSources[currentSourceIndex];
            
            try {
                const videoUrl = await fetchVideoUrl(currentSource);
                // 如果已经不是最新任务，则丢弃结果
                if (myToken !== currentLoadToken) return;

                player.src = videoUrl;
                updateSourceDisplay();

                try {
                    await player.play();
                    // 播放成功，重置重试
                    if (myToken !== currentLoadToken) return;
                    resetSourceRetry();
                } catch (playErr) {
                    if (myToken !== currentLoadToken) return;

                    if (playErr.name === 'NotAllowedError') {
                        showStatus('请点击【换一个】按钮开始（浏览器限制自动播放）', true);
                    } else {
                        handleLoadFailure(myToken, currentSource);
                    }
                }
            } catch (err) {
                if (myToken !== currentLoadToken) return;
                console.error('获取视频地址失败:', currentSource, err);
                handleLoadFailure(myToken, currentSource);
            }
        }

        // 加载失败处理（重试或切换源）
        function handleLoadFailure(myToken, currentSource) {
            const allSources = getAllSources();

            if (currentSourceRetries < maxRetriesPerSource) {
                currentSourceRetries++;
                showStatus(`当前源重试中(${currentSourceRetries}/${maxRetriesPerSource})...`, true);
                setTimeout(() => {
                    // 只有当前任务仍然是最新的，才继续重试
                    if (myToken === currentLoadToken) {
                        loadRandomVideo();
                    }
                }, 1000);
            } else {
                showStatus(`当前源已重试${maxRetriesPerSource}次失败，切换到下一个源...`, true);
                resetSourceRetry();
                currentSourceIndex = (currentSourceIndex + 1) % allSources.length;
                setTimeout(() => {
                    if (myToken === currentLoadToken) {
                        loadRandomVideo();
                    }
                }, 500);
            }
        }

        // 切换到下一个源
        function switchToNextSource() {
            const allSources = getAllSources();
            if (allSources.length === 0) return;
            currentSourceIndex = (currentSourceIndex + 1) % allSources.length;
            resetSourceRetry();
            loadRandomVideo();
        }

        // 使用指定用户源
        function useSource(index) {
            currentSourceIndex = index;
            resetSourceRetry();
            loadRandomVideo();
        }

        // 删除用户源
        function deleteSource(userSourceIndex) {
            const sourceToDelete = userSources[userSourceIndex];
            const allSources = getAllSources();

            userSources.splice(userSourceIndex, 1);
            saveUserSources();
            renderSourceList();
            updateSourceDisplay();

            // 如果删除的是当前正在播放的源，必须重新加载
            if (allSources[currentSourceIndex] === sourceToDelete) {
                currentSourceIndex = 0;
                resetSourceRetry();
                loadRandomVideo();
            }
        }

        // 添加新源
        function addNewSource() {
            const newSource = elements.newSourceInput.value.trim();

            if (!newSource) {
                showStatus('请输入有效的视频API地址', true);
                return;
            }

            if (!newSource.startsWith('http://') && !newSource.startsWith('https://')) {
                showStatus('URL必须以http://或https://开头', true);
                return;
            }

            if (getAllSources().includes(newSource)) {
                showStatus('该视频源已存在', true);
                return;
            }

            userSources.unshift(newSource);
            elements.newSourceInput.value = '';
            saveUserSources();

            currentSourceIndex = 0;
            resetSourceRetry();
            renderSourceList();
            showStatus('视频源添加成功', false);
            loadRandomVideo();
        }

        // 保存用户源到本地存储
        function saveUserSources() {
            localStorage.setItem('userVideoSources', JSON.stringify(userSources));
        }

        // 渲染用户源列表
        function renderSourceList() {
            requestAnimationFrame(() => {
                elements.sourceList.innerHTML = '';

                if (userSources.length === 0) {
                    elements.sourceList.innerHTML = '<div style="text-align: center; padding: 10px; color: #888;">暂无自定义视频源，请添加</div>';
                    return;
                }

                const fragment = document.createDocumentFragment();

                userSources.forEach((source, index) => {
                    const sourceItem = document.createElement('div');
                    sourceItem.className = 'source-item';

                    const sourceUrl = document.createElement('span');
                    sourceUrl.className = 'source-url';
                    sourceUrl.textContent = source;

                    const sourceActions = document.createElement('div');
                    sourceActions.className = 'source-actions';

                    const useBtn = document.createElement('button');
                    useBtn.textContent = '使用';
                    useBtn.addEventListener('click', () => useSource(index));

                    const deleteBtn = document.createElement('button');
                    deleteBtn.textContent = '删除';
                    deleteBtn.addEventListener('click', () => deleteSource(index));

                    sourceActions.appendChild(useBtn);
                    sourceActions.appendChild(deleteBtn);

                    sourceItem.appendChild(sourceUrl);
                    sourceItem.appendChild(sourceActions);

                    fragment.appendChild(sourceItem);
                });

                elements.sourceList.appendChild(fragment);
            });
        }

        // 事件监听
        elements.toggleAuto.addEventListener('click', function() {
            autoPlay = !autoPlay;
            localStorage.setItem('autoPlay', autoPlay);
            updateAutoPlayButton();
        });

        elements.nextVideo.addEventListener('click', function() {
            resetSourceRetry();
            loadRandomVideo();
        });

        elements.switchSource.addEventListener('click', function() {
            resetSourceRetry();
            switchToNextSource();
        });

        elements.addSource.addEventListener('click', addNewSource);

        elements.newSourceInput.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                addNewSource();
            }
        });

        // 视频结束事件
        player.addEventListener('ended', function() {
            if (autoPlay) {
                resetSourceRetry();
                loadRandomVideo();
            }
        });

        // 视频错误事件
        player.addEventListener('error', function() {
            console.error('视频播放错误');
            // 如果当前没有在执行加载任务，则尝试切源
            // 由于使用了任务编号，这里直接重新加载是安全的
            if (currentSourceRetries < maxRetriesPerSource) {
                currentSourceRetries++;
                showStatus(`播放错误，重试中(${currentSourceRetries}/${maxRetriesPerSource})...`, true);
                setTimeout(() => loadRandomVideo(), 1000);
            } else {
                showStatus('播放错误，切换到下一个源...', true);
                resetSourceRetry();
                currentSourceIndex = (currentSourceIndex + 1) % getAllSources().length;
                loadRandomVideo();
            }
        });

        // 初始化
        updateAutoPlayButton();
        renderSourceList();
        updateSourceDisplay();
        resetSourceRetry();
        loadRandomVideo();
    });
</script>
</body>]]>
    </description>
    <link>https://cms.4km.cc.cd/i/测试代码-tWOeugxry5W/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
  <item>
    <title>随机API图片 - 网页端</title>
    <guid>hao3XTx1qpp</guid>
    <pubDate>Thu, 03 Sep 2026 03:09:17 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<!-- 随机图片切换器（博客嵌入）最终版 -->
<style>
.random-img-box {
  max-width: 100%;
  margin: 15px 0;
  text-align: center;
  position: relative;
  /* 核心：容器强制16:9比例，宽度不变，高度自动跟随16/9 */
  aspect-ratio: 16 / 9;
  /* 最小保护，小屏幕不会缩得太矮 */
  min-height: 320px;
  /* 最大上限，防止大屏过高 */
  max-height: 550px;
}

.random-img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* 完整展示原图，不拉伸不裁剪 */
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  background: #fff !important; /* 留白区域纯白色 */
  /* 删除重复冲突的两套max‑height，交给父容器aspect‑ratio管控 */
}
.random-btn { padding: 10px 30px; margin-top: 12px; background: #4299e1; color: #fff; border: none; border-radius: 25px; cursor: pointer; font-size: 14px; }
.random-btn:hover { background: #3182ce; }
.random-loading { 
  color: #666; 
  padding: 20px 0; 
  position: absolute; /* 绝对定位 不占位 */
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}
</style>
<div class="random-img-box">
  <div class="random-loading" id="imgLoading">加载中...</div>
  <img class="random-img" id="blogRandomImg" alt="随机图片" style="display: none;">
  <br>
  <button class="random-btn" id="refreshImgBtn">换一张图片</button>
</div>
<br>
<script>
const RANDOM_API = "https://www.dmoe.cc/random.php";
const imgDom = document.getElementById("blogRandomImg");
const loadingDom = document.getElementById("imgLoading");
const btnDom = document.getElementById("refreshImgBtn");

function loadNewImg() {
  // 删掉隐藏旧图+显示加载中  实现无缝换图不跳动
  let random = Date.now() + Math.floor(Math.random()*10000);
  imgDom.src = `${RANDOM_API}?t=${random}`;
}

imgDom.onload = () => { loadingDom.style.display = "none"; imgDom.style.display = "block"; };
imgDom.onerror = () => { loadNewImg(); };

setTimeout(()=>{
  loadNewImg();
  btnDom.addEventListener("click", loadNewImg);
},100);
</script>
<br>]]>
    </description>
    <link>https://cmsr.4km.cc.cd/i/api-hao3XTx1qpp/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
  <item>
    <title>随机小姐姐 - 网页端</title>
    <guid>3ekn1Z9Lcn9</guid>
    <pubDate>Thu, 03 Sep 2026 01:56:50 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机小姐姐</title>
    <style>
        /* 原有样式不变 */
        //body {
            font-family: 'Arial', sans-serif;
            max-width: 1000px;
            margin: 0 auto;
            padding: 15px;
            background-color: #f5f5f5;
        }
        
        #player-container {
            background: #000;
            border-radius: 8px;
            margin-bottom: 15px;
            overflow: hidden;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        
        #player {
            width: 100%;
            height: auto;
            //max-height: 80vh;
            //min-height: 250px;
            min-height: 545px;
            max-height: 550px;
            display: block;
        }
        
        .control-panel {
            //background: white;
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-bottom: 15px;
        }
        
        .button-group {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }
        
        button {
            background: #7F9CCC;
            color: #fff;
            border: none;
            padding: 10px 12px;
            border-radius: 6px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            flex-grow: 1;
            font-size: 14px;
            min-width: 80px;
        }
        
        button:hover {
            background: #6A8BBC;
            transform: translateY(-1px);
        }
        
        button#toggleAuto {
            flex-grow: 2;
        }
        
        .source-management {
            margin-top: 15px;
        }
        
        .source-list {
            margin-top: 10px;
            max-height: 30vh;
            overflow-y: auto;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 8px;
            //background: white;
        }
        
        .source-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px;
            border-bottom: 1px solid #eee;
        }
        
        .source-item:last-child {
            border-bottom: none;
        }
        
        .source-url {
            flex-grow: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-right: 8px;
            font-size: 14px;
        }
        
        .source-actions {
            display: flex;
            gap: 5px;
        }
        
        .source-actions button {
            padding: 5px 8px;
            font-size: 12px;
            background: #ff6b6b;
            min-width: 50px;
            flex-grow: 0;
        }
        
        .source-actions button:first-child {
            background: #4CAF50;
        }
        
        .add-source-form {
            display: flex;
            gap: 8px;
            margin-top: 12px;
        }
        
        .add-source-form input {
            flex-grow: 1;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }
        
        .add-source-form button {
            width: 90px;
            flex-grow: 0;
        }
        
        .status {
            margin-top: 10px;
            font-size: 14px;
            color: #666;
            text-align: center;
        }
        
        .current-source {
            font-weight: bold;
            color: #7F9CCC;
            word-break: break-all;
        }
        
        .default-source-indicator {
            color: #888;
            font-style: italic;
            margin-top: 5px;
        }
        
        /* 手机端优化 */
        @media (max-width: 600px) {
            body {
                padding: 10px;
            }
            
            #player {
                //min-height: 200px;
                min-height: 540px;
            }
            
            .control-panel {
                padding: 12px;
            }
            
            button {
                padding: 8px 10px;
                font-size: 13px;
            }
            
            .source-item {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .source-actions {
                margin-top: 5px;
                width: 100%;
                justify-content: flex-end;
            }
            
            .add-source-form {
                flex-direction: column;
            }
            
            .add-source-form button {
                width: 100%;
            }
        }
    </style>
</head>
<h1 style="text-align: center; margin-bottom: 15px;">随机小姐姐</h1>
<div id="player-container"><video id="player" controls playsinline></video></div>
<div class="control-panel">
  <div class="button-group"><button id="toggleAuto">连续播放: 开</button>
            <button id="nextVideo">换一个 ▶</button>
            <button id="switchSource">切换源</button></div>
  <div class="status" id="statusArea"><!-- 状态信息将在这里动态生成 --></div>
  <div class="source-management">
    <h3 style="margin-bottom: 8px;">视频源管理</h3>
    <div class="source-list" id="sourceList"><!-- 视频源列表将在这里动态生成 --></div>
    <div class="add-source-form"><input type="text" id="newSourceInput" placeholder="输入视频API地址">
                <button id="addSource">添加源</button></div>
  </div>
</div>
<script>
        document.addEventListener('DOMContentLoaded', function() {
            // 隐藏的默认源 (不在界面显示)
            const defaultSources = [
                'https://www.ximi.me/video/list.php',
                'http://api.yujn.cn/api/zzxjj.php?type=video',
                'https://api.xudu.org/vos/vc',
                'https://openapi.dwo.cc/api/viodes'
            ];
            
            // 用户添加的源
            let userSources = JSON.parse(localStorage.getItem('userVideoSources')) || [];
            
            // 获取所有源 (默认源 + 用户源)
            function getAllSources() {
                return [...userSources, ...defaultSources];
            }
            
            let currentSourceIndex = 0;
            let autoPlay = localStorage.getItem('autoPlay') !== 'false';
            const player = document.getElementById('player');
            let isProcessing = false; // 防止重复操作
            
            // 添加：单源内重试控制（核心修改）
            let currentSourceRetries = 0; // 当前源的重试次数
            const maxRetriesPerSource = 2; // 单个源的最大重试次数（可自定义）
            
            // DOM元素
            const elements = {
                toggleAuto: document.getElementById('toggleAuto'),
                nextVideo: document.getElementById('nextVideo'),
                switchSource: document.getElementById('switchSource'),
                sourceList: document.getElementById('sourceList'),
                newSourceInput: document.getElementById('newSourceInput'),
                addSource: document.getElementById('addSource'),
                statusArea: document.getElementById('statusArea')
            };
            
            // 添加：重置当前源的重试计数
            function resetSourceRetry() {
                currentSourceRetries = 0;
            }
            
            // 初始化播放器
            function initPlayer() {
                updateAutoPlayButton();
                updateSourceDisplay();
                renderSourceList();
                
                // 如果有用户源，优先使用第一个用户源
                if (userSources.length > 0) {
                    currentSourceIndex = 0;
                } else {
                    // 否则使用第一个默认源
                    currentSourceIndex = defaultSources.length > 0 ? userSources.length : 0;
                }
                
                resetSourceRetry(); // 初始化时重置重试计数
                loadRandomVideo();
            }
            
            // 更新自动播放按钮状态
            function updateAutoPlayButton() {
                elements.toggleAuto.textContent = `连续播放: ${autoPlay ? '开' : '关'}`;
            }
            
            // 加载随机视频（核心修改：单源内重试逻辑）
            function loadRandomVideo() {
                if (isProcessing) return;
                isProcessing = true;
                
                const allSources = getAllSources();
                if (allSources.length === 0) {
                    showStatus('无可用视频源，请添加视频源', true);
                    isProcessing = false;
                    return;
                }
                
                // 确保索引在有效范围内
                if (currentSourceIndex >= allSources.length) {
                    currentSourceIndex = 0;
                }
                
                const currentSource = allSources[currentSourceIndex];
                const timestamp = new Date().getTime();
                const randomParam = Math.random();
                
                let videoUrl = currentSource;
                if (currentSource.includes('?')) {
                    videoUrl += `&_t=${timestamp}_${randomParam}`;
                } else {
                    videoUrl += `?_t=${timestamp}_${randomParam}`;
                }
                
                player.src = videoUrl;
                updateSourceDisplay();
                
                // 使用requestAnimationFrame来优化性能
                requestAnimationFrame(() => {
                    player.play().catch(e => {
                        console.error(`当前源第${currentSourceRetries+1}次播放失败:`, e);
                        
                        // 1. 区分错误类型处理
                        if (e.name === 'NotAllowedError') {
                            // 浏览器拦截自动播放（非源错误），提示用户手动点击
                            showStatus('请点击【换一个】按钮开始（浏览器限制自动播放）', true);
                        } else {
                            // 源错误：判断是否达到单源最大重试次数
                            if (currentSourceRetries < maxRetriesPerSource) {
                                // 未达最大次数，重试当前源（同一源多次尝试）
                                currentSourceRetries++;
                                showStatus(`当前源重试中(${currentSourceRetries}/${maxRetriesPerSource})...`, true);
                                
                                // 短暂延迟后重试（避免频繁请求）
                                setTimeout(() => {
                                    loadRandomVideo(); // 重试当前源
                                }, 1000);
                                return; // 提前退出，不执行后续解锁逻辑（交由重试处理）
                            } else {
                                // 达到单源最大重试次数，切换到下一个源
                                showStatus(`当前源已重试${maxRetriesPerSource}次失败，切换到下一个源...`, true);
                                resetSourceRetry(); // 重置当前源重试计数
                                switchToNextSource(); // 切换到新源
                            }
                        }
                    }).finally(() => {
                        // 2. 无论成败，最终解锁（确保下次能操作）
                        isProcessing = false;
                        
                        // 播放成功时重置当前源重试计数（例如用户手动点击播放）
                        if (player.paused === false) {
                            resetSourceRetry();
                        }
                    });
                });
            }
            
            // 显示状态信息
            function showStatus(message, isError = false) {
                requestAnimationFrame(() => {
                    elements.statusArea.innerHTML = `<div class="status-message" style="color: ${isError ? '#ff4444' : '#666'}">${message}</div>`;
                });
            }
            
            // 切换到下一个源
            function switchToNextSource() {
                if (isProcessing) return;
                
                const allSources = getAllSources();
                if (allSources.length === 0) return;
                
                currentSourceIndex = (currentSourceIndex + 1) % allSources.length;
                resetSourceRetry(); // 切换源时重置重试计数
                loadRandomVideo();
            }
            
            // 更新当前源显示
            function updateSourceDisplay() {
                const allSources = getAllSources();
                if (allSources.length > 0) {
                    const currentSource = allSources[currentSourceIndex];
                    const isDefaultSource = defaultSources.includes(currentSource);
                    
                    requestAnimationFrame(() => {
                        if (isDefaultSource) {
                            // 使用默认源时不显示具体URL
                            elements.statusArea.innerHTML = `
                                <div class="status-message">正在使用系统默认视频源</div>
                                <div class="default-source-indicator">如需更好体验，请添加自定义视频源</div>
                            `;
                        } else {
                            // 使用用户源时显示URL
                            elements.statusArea.innerHTML = `
                                <div class="status-message">当前视频源:</div>
                                <div class="current-source">${currentSource}</div>
                            `;
                        }
                    });
                } else {
                    showStatus('无可用视频源，请添加视频源', true);
                }
            }
            
            // 渲染源列表 (只显示用户添加的源)
            function renderSourceList() {
                requestAnimationFrame(() => {
                    elements.sourceList.innerHTML = '';
                    
                    if (userSources.length === 0) {
                        elements.sourceList.innerHTML = '<div style="text-align: center; padding: 10px; color: #888;">暂无自定义视频源，请添加</div>';
                        return;
                    }
                    
                    const fragment = document.createDocumentFragment();
                    
                    userSources.forEach((source, index) => {
                        const sourceItem = document.createElement('div');
                        sourceItem.className = 'source-item';
                        
                        const sourceUrl = document.createElement('span');
                        sourceUrl.className = 'source-url';
                        sourceUrl.textContent = source;
                        
                        const sourceActions = document.createElement('div');
                        sourceActions.className = 'source-actions';
                        
                        const useBtn = document.createElement('button');
                        useBtn.textContent = '使用';
                        useBtn.addEventListener('click', () => {
                            if (!isProcessing) {
                                resetSourceRetry(); // 用户主动操作，重置重试计数
                                useSource(index);
                            }
                        });
                        
                        const deleteBtn = document.createElement('button');
                        deleteBtn.textContent = '删除';
                        deleteBtn.addEventListener('click', () => {
                            if (!isProcessing) deleteSource(index);
                        });
                        
                        sourceActions.appendChild(useBtn);
                        sourceActions.appendChild(deleteBtn);
                        
                        sourceItem.appendChild(sourceUrl);
                        sourceItem.appendChild(sourceActions);
                        
                        fragment.appendChild(sourceItem);
                    });
                    
                    elements.sourceList.appendChild(fragment);
                });
            }
            
            // 删除源
            function deleteSource(userSourceIndex) {
                if (isProcessing) return;
                isProcessing = true;
                
                const allSources = getAllSources();
                const sourceToDelete = userSources[userSourceIndex];
                
                // 检查是否正在使用要删除的源
                if (allSources[currentSourceIndex] === sourceToDelete) {
                    // 如果删除的是当前正在使用的源，切换到下一个源
                    switchToNextSource();
                }
                
                userSources.splice(userSourceIndex, 1);
                saveUserSources();
                renderSourceList();
                updateSourceDisplay();
                
                // 如果没有用户源了，自动切换到默认源
                if (userSources.length === 0 && allSources.length > 0) {
                    currentSourceIndex = allSources.length - 1; // 切换到最后一个源(默认源)
                    loadRandomVideo();
                }
                
                isProcessing = false;
            }
            
            // 使用指定源
            function useSource(index) {
                if (isProcessing) return;
                currentSourceIndex = index;
                loadRandomVideo();
            }
            
            // 添加新源
            function addNewSource() {
                if (isProcessing) return;
                isProcessing = true;
                
                const newSource = elements.newSourceInput.value.trim();
                
                if (!newSource) {
                    showStatus('请输入有效的视频API地址', true);
                    isProcessing = false;
                    return;
                }
                
                // 简单验证URL格式
                if (!newSource.startsWith('http://') && !newSource.startsWith('https://')) {
                    showStatus('URL必须以http://或https://开头', true);
                    isProcessing = false;
                    return;
                }
                
                // 检查是否已存在(包括默认源)
                if (getAllSources().includes(newSource)) {
                    showStatus('该视频源已存在', true);
                    isProcessing = false;
                    return;
                }
                
                userSources.unshift(newSource); // 添加到开头
                elements.newSourceInput.value = '';
                saveUserSources();
                
                // 使用新添加的源
                currentSourceIndex = 0;
                resetSourceRetry(); // 添加新源后重置重试计数
                loadRandomVideo();
                renderSourceList();
                
                showStatus('视频源添加成功', false);
                isProcessing = false;
            }
            
            // 保存用户源到本地存储
            function saveUserSources() {
                localStorage.setItem('userVideoSources', JSON.stringify(userSources));
            }
            
            // 事件监听 - 使用事件委托优化性能
            document.addEventListener('click', function(e) {
                if (e.target === elements.toggleAuto) {
                    autoPlay = !autoPlay;
                    localStorage.setItem('autoPlay', autoPlay);
                    updateAutoPlayButton();
                } else if (e.target === elements.nextVideo) {
                    resetSourceRetry(); // 用户主动点击"换一个"，重置重试计数
                    loadRandomVideo();
                } else if (e.target === elements.switchSource) {
                    resetSourceRetry(); // 用户主动切换源，重置重试计数
                    switchToNextSource();
                } else if (e.target === elements.addSource) {
                    addNewSource();
                }
            });
            
            // 按Enter键添加源
            elements.newSourceInput.addEventListener('keypress', function(e) {
                if (e.key === 'Enter') {
                    addNewSource();
                }
            });
            
            // 视频结束事件
            player.addEventListener('ended', function() {
                if (autoPlay && !isProcessing) {
                    resetSourceRetry(); // 视频正常结束后，重置重试计数
                    loadRandomVideo();
                }
            });
            
            // 视频错误事件（补充处理）
            player.addEventListener('error', function() {
                if (!isProcessing && currentSourceRetries < maxRetriesPerSource) {
                    // 播放器错误事件也触发重试逻辑
                    currentSourceRetries++;
                    showStatus(`当前源重试中(${currentSourceRetries}/${maxRetriesPerSource})...`, true);
                    setTimeout(() => loadRandomVideo(), 1000);
                }
            });
            
            // 初始化
            initPlayer();
        });
    </script>]]>
    </description>
    <link>https://cmsr.4km.cc.cd/i/随机小姐姐-网页端-3ekn1Z9Lcn9/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
</channel>
</rss>