-
-
Save yukiarimo/8be25767362f580434aec0fc39504d3d to your computer and use it in GitHub Desktop.
| function extractAndDownloadAllChapters() { | |
| // Find all containers that hold chapter text | |
| const chapterContainers = document.querySelectorAll('.cha-words'); | |
| // Initialize an array to hold all chapter texts | |
| let allChaptersText = []; | |
| // Iterate over each chapter container | |
| chapterContainers.forEach(container => { | |
| // Get all paragraph elements within the container | |
| const paragraphs = container.querySelectorAll('p'); | |
| // Extract the text from each paragraph and join them with a newline character | |
| const chapterText = Array.from(paragraphs).map(p => p.textContent.trim()).join('\n'); | |
| // Add the chapter text to the array | |
| allChaptersText.push(chapterText); | |
| }); | |
| // Join all chapters with two newline characters to separate them | |
| const allText = allChaptersText.join('\n\n'); | |
| // Create a Blob with the combined text content | |
| const blob = new Blob([allText], { | |
| type: 'text/plain' | |
| }); | |
| // Create an anchor element and use it to trigger the download | |
| const anchor = document.createElement('a'); | |
| anchor.href = URL.createObjectURL(blob); | |
| anchor.download = 'allChaptersText.txt'; | |
| document.body.appendChild(anchor); | |
| anchor.click(); | |
| document.body.removeChild(anchor); | |
| } |
Hey, I tried downloading and was successful in doing so. I got the .txt file but the locked chapters only have excerpt not the full version
Hey, I tried downloading and was successful in doing so. I got the .txt file but the locked chapters only have excerpt not the full version
Did you click the chapter explicitly then scrolled down?
I've have a riviesed version to get the chapter titles too it should work. It's in forks
i tried using it but it is not working for the locked chapters it only shows a part of the locked chapter
i tried using it but it is not working for the locked chapters it only shows a part of the locked chapter
it doesn't work for the locked chapters you have to find one they has them unlocked
i only ever really used this on fanfictions since those are locked
Thank you! Works greatly.