您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Extract episode number, title, and description from elcinema.com and save to file
当前为
// ==UserScript== // @name elcinema Episode title and description Extractor // @namespace https://greasyfork.org/en/scripts/520447-elcinema-episode-title-and-description-extractor // @version 1.8 // @description Extract episode number, title, and description from elcinema.com and save to file // @author Your Name // @match https://elcinema.com/work/*/episodes // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to extract episode data function extractEpisodeData() { const episodeContainers = document.querySelectorAll('.row'); const episodes = []; episodeContainers.forEach((container, index) => { const episodeNumberElement = container.querySelector('ul.list-separator > li:nth-child(2)'); const episodeTitleElement = container.querySelector('h6.text-center'); const descriptionElement = container.querySelector('div.columns.large-9 > p'); const nextSiblingElement = container.nextElementSibling; // This should be the button element if (episodeNumberElement && episodeTitleElement && descriptionElement && nextSiblingElement && nextSiblingElement.tagName === 'A') { const episodeNumber = episodeNumberElement.textContent.match(/#(\d+)/)[1].trim(); const episodeTitle = episodeTitleElement.textContent.trim(); const description = descriptionElement.textContent.trim(); episodes.push({ episodeNumber, episodeTitle, description }); // Debugging information for each episode console.log(`Episode ${index + 1}:`); console.log(`Number: ${episodeNumber}`); console.log(`Title: ${episodeTitle}`); console.log(`Description: ${description}`); console.log(`Details Link: ${nextSiblingElement.href}`); // For matching purposes } else { console.log(`Episode ${index + 1} is missing data.`); } }); // Sort episodes by episode number to ensure correct order episodes.sort((a, b) => a.episodeNumber - b.episodeNumber); return episodes; } // Function to save data to a file function saveToFile(data, filename) { const blob = new Blob([JSON.stringify(data, null, 2)], {type: 'application/json'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } // Function to create the save button function createSaveButton() { const saveButton = document.createElement('button'); saveButton.textContent = 'Save Episode Data'; saveButton.style.width = '100%'; saveButton.style.padding = '10px'; saveButton.style.margin = '10px 0'; saveButton.style.backgroundColor = '#4CAF50'; saveButton.style.color = 'white'; saveButton.style.border = 'none'; saveButton.style.borderRadius = '4px'; saveButton.style.cursor = 'pointer'; saveButton.addEventListener('click', () => { const episodes = extractEpisodeData(); saveToFile(episodes, 'episodes_titles.json'); }); const splitElement = document.querySelector('hr.split'); if (splitElement) { splitElement.parentNode.insertBefore(saveButton, splitElement.nextSibling); } } // Run the function to create the save button when the page loads window.addEventListener('load', createSaveButton); })();