<?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>随机小姐姐 - 网页端</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>