// ==UserScript== // @name Crunchyroll Arabic Episode Titles and Descriptions Extractor // @namespace https://greasyfork.org/en/scripts/518373-crunchyroll-arabic-episode-titles-and-descriptions-extractor // @version 1.7 // @description Extract titles, episode numbers, and descriptions of all episodes on Crunchyroll and save them as JSON // @author Abu3safeer // @match https://www.crunchyroll.com/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Function to download data as JSON file function downloadJSON(data, filename) { const dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(data, null, 2)); const downloadAnchorNode = document.createElement('a'); downloadAnchorNode.setAttribute("href", dataStr); downloadAnchorNode.setAttribute("download", filename); document.body.appendChild(downloadAnchorNode); downloadAnchorNode.click(); downloadAnchorNode.remove(); } // Function to extract titles, episode numbers, and descriptions function extractEpisodeInfo() { const episodes = []; const elements = document.querySelectorAll('div[class*="playable-card-hover__body"]'); elements.forEach(element => { const titleElement = element.querySelector('h4[data-t="episode-title"]'); const descriptionElement = element.querySelector('p[data-t="description"]'); if (titleElement && descriptionElement) { const titleText = titleElement.textContent.trim(); const titleMatch = titleText.match(/ح(\d+)\s*-\s*(.*)/); if (titleMatch) { const episodeNumber = titleMatch[1]; const episodeTitle = titleMatch[2]; const description = descriptionElement.textContent.trim(); episodes.push({ episodeNumber, episodeTitle, description }); } } }); console.log('Episodes:', episodes); downloadJSON(episodes, 'episodes_titles.json'); displayEpisodes(episodes); // Display episodes in a popup } // Display episodes in a popup function displayEpisodes(episodes) { const popup = window.open('', '_blank', 'width=800,height=600'); popup.document.write('
${ep.description}