您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Extract and format information from Ximalaya webpage
当前为
// ==UserScript== // @name CRABPT Ximalaya Information Extractor // @namespace http://tampermonkey.net/ // @version 0.4 // @description Extract and format information from Ximalaya webpage // @author Crabpt // @license Crabpt // @match https://www.ximalaya.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // Create copy button function createCopyButton() { const button = document.createElement('button'); button.textContent = '复制信息'; button.style.position = 'fixed'; button.style.top = '20px'; button.style.right = '20px'; button.style.zIndex = '9999'; button.style.padding = '10px'; button.style.backgroundColor = '#fc5832'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.addEventListener('click', extractAndCopyInfo); document.body.appendChild(button); } // Process text content function processText(text) { if (!text) return ''; // Split into sections and process each const sections = text.split('\n\n'); const processedSections = []; let skipSection = false; for (let i = 0; i < sections.length; i++) { const section = sections[i].trim(); // Skip empty sections if (!section) continue; // Skip purchase information section if (section.includes('购买须知') || section.includes('本作品为付费有声书') || section.includes('版权归原作者所有') || section.includes('如在充值/购买环节遇到问题') || section.includes('在购买过程中')) { skipSection = true; continue; } // Reset skip flag when reaching a new major section if (section === 'staff' || section === 'cast' || section.includes('内容简介')) { skipSection = false; } // Skip sections if flag is true if (skipSection) continue; // Special formatting for sections if (section.includes('【冒泡有奖】')) { processedSections.push(`[quote][color=#FF6B6B]${section}[/color][/quote]`); } else if (section.startsWith('版权方:') || section.startsWith('作 者:') || section.startsWith('策 划:') || section.startsWith('画 本:')) { processedSections.push(`[*]${section}`); } else if (section.startsWith('男:') || section.startsWith('女:')) { // Keep cast information in a more compact format const lines = section.split('\n').filter(line => line.trim()); processedSections.push(lines.join('\n')); } else { processedSections.push(section); } } // Join sections with single newline return processedSections.join('\n'); } // Extract and format information function extractAndCopyInfo() { // Get current page URL const currentUrl = window.location.href; // Get main image const mainImage = document.querySelector('.img.z_i'); const mainImageUrl = mainImage ? mainImage.src : ''; // Get display image from article const articleImage = document.querySelector('article.intro img'); const displayImageUrl = articleImage ? articleImage.src : ''; // Get title const title = document.querySelector('h1.title.z_i'); const titleText = title ? title.textContent.trim() : ''; // Get introduction content const article = document.querySelector('article.intro'); let introText = ''; if (article) { const paragraphs = article.querySelectorAll('p'); introText = Array.from(paragraphs) .map(p => p.textContent.trim()) .filter(text => text) .join('\n\n'); } // Format the output const formattedText = `[center][size=6][color=#FC5832][b]${titleText}[/b][/color][/size][/center] [center][size=5][color=#2C3E50][b]━━━━━ 封面展示 ━━━━━[/b][/color][/size][/center] [center][img]${mainImageUrl}[/img][/center] [center][size=5][color=#2C3E50][b]━━━━━ 详情介绍 ━━━━━[/b][/color][/size][/center] [center][img]${displayImageUrl}[/img][/center] [quote][size=4][color=#2C3E50][b]内容简介[/b][/color][/size] ${processText(introText)}[/quote] [size=4][color=#2C3E50][b]资源信息[/b][/color][/size] [quote][color=#666666]原网址:[url=${currentUrl}]${currentUrl}[/url][/color][/quote] [center][size=3][color=#999999]━━━━━ CRABPT ━━━━━[/color][/size][/center]`; // Copy to clipboard navigator.clipboard.writeText(formattedText).then(() => { alert('信息已复制到剪贴板!'); }).catch(err => { console.error('复制失败:', err); alert('复制失败,请手动复制'); }); } // Initialize createCopyButton(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址