WebToEpub icon indicating copy to clipboard operation
WebToEpub copied to clipboard

Writing the script in the epub editor did not unscramble the text for me

Open readingthings8-cell opened this issue 4 months ago • 20 comments

@dteviot I tried replacing the values in the script you provided with the cypher and font combos and it works!!! Woohoo! Thanks so much!

@bonnetchuu @lunevale @bookimp @gamebeaker just copy-paste the script below into the space provided in Epub Editor then drag and drop your CG epub into the Drop Zone. Image

Lastly, click the [Run script above to modify Epub] button, then save! Image

function decrypt(clear, selector) {
    let crypt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    let decryptTable = new Map();
    for(let i = 0; i < crypt.length; ++i) {
        decryptTable.set(crypt[i], clear[i]);
    }
    let decryptChar = (c) => decryptTable.get(c) ?? c;
    let decryptString = (cypherText) => cypherText.split("").map(c => decryptChar(c)).join("");
    for(let e of dom.querySelectorAll(selector)) {
        console.log(e.textContent);
        e.textContent = decryptString(e.textContent);
        console.log(e.textContent);
    }
}

decrypt("qVTPNEAHbykpxiYtlWdOzUGnsMcZXBQuSaRKICJwgFLDefrvhmjo", "span[style*='ZxXoTeIptL']");
decrypt("PwyUBVTYqAXxZMfEjrSeDazCkWoivHJbKltNdLOhupgImQscnFRG", "span[style*='ijqXQijeiD']");
decrypt("dTKbCMwpkGWJrJOUiFVesPoXRfQSmuvqglEyDBLnzIYHAZcaxthN", "span[style*='WTKNOkuWha']");
decrypt("JznCuUZtTgKGAkvwBSOYLHsihaNEPpMVefWRoqlymbjcIXrdQDFx", "span[style*='rnlfJtfRCW']");
decrypt("cHMZtWYfaEipjXbRPLogAFSBDVrOmUNxIlkeCszTuwKhdJnGqQyv", "span[style*='LPJMfkmHKG']");

return true;

Originally posted by @blucat678 in #2173

HI, So i tried putting in this script into epub editor and it didn't unscramble my epub text from chysanthemum garden

readingthings8-cell avatar Sep 25 '25 12:09 readingthings8-cell

@readingthings8-cell Test versions for Firefox and Chrome have been uploaded to https://github.com/dteviot/WebToEpub/releases/tag/developer-build. Pick the one suitable for you, follow the "How to install from Source (for people who are not developers)" instructions at https://github.com/dteviot/WebToEpub/tree/ExperimentalTabMode#user-content-installation and let me know how it goes.

and than the last button on epub editor ("link extra fonts")

I am curious why did you stop reading after this comment in #2173?

gamebeaker avatar Sep 25 '25 13:09 gamebeaker

To be honest, I did try to read ahead but the CSS and the cyphens kind of confused me. I also just tried the above instructions, installed the latest version then ran the above script above and it didn't work. So I tried it again and tried doing the last button as well to link extra fonts but it still hasn't unscrambled the text. Furthermore, I noticed on the new version it skipped one chapter? Idk why webtoepub did that. Maybe it's the type of novel. Here is the link of what I was trying to download : https://chrysanthemumgarden.com/novel-tl/abtme/

Also I had a question I guess, do we delete the original script already in epub editor before adding the new script or do both scripts need to run along together? (not sure if this a stupid question, I'm really unfamiliar with this)

readingthings8-cell avatar Sep 25 '25 14:09 readingthings8-cell

@readingthings8-cell at the moment we keep both as they do different things. The "old" button tries to decrypt the text the new one just changes the font of the scrambled text.

I just found two bugs in WebToEpub where you need to download the novel in a "fresh" WebToEpub" tab and where it ties to download an invalid url.

I fixed them in a new test version. Test versions for Firefox and Chrome have been uploaded to https://github.com/dteviot/WebToEpub/releases/tag/developer-build. Pick the one suitable for you, follow the "How to install from Source (for people who are not developers)" instructions at https://github.com/dteviot/WebToEpub/tree/ExperimentalTabMode#user-content-installation and let me know how it goes.

gamebeaker avatar Sep 25 '25 15:09 gamebeaker

Okay, I tried it for one novel and was really excited cause yes it worked but then I tried to check for another novel: https://chrysanthemumgarden.com/novel-tl/amtwbd/ and it just didn't work anymore. I even ran the script above like twice and it still refused to work, so I guess it's selective? Idk.

readingthings8-cell avatar Sep 26 '25 14:09 readingthings8-cell

@readingthings8-cell which script do you mean?

I fixed the method where you link the fonts not the script. I marked with red the two buttons:

Image

The last button should work more reliable. If the last button doesn't work please write a new comment here if it is the other button please write in: #2173

gamebeaker avatar Sep 26 '25 14:09 gamebeaker

So I tried dowloading https://chrysanthemumgarden.com/novel-tl/mde/

The Clean CG button worked fine in removing that last bit on the end of the sentences, but the Link Extra fonts did not unscramble it and neither did running the following script:

function decrypt(clear, selector) { let crypt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; let decryptTable = new Map(); for(let i = 0; i < crypt.length; ++i) { decryptTable.set(crypt[i], clear[i]); } let decryptChar = (c) => decryptTable.get(c) ?? c; let decryptString = (cypherText) => cypherText.split("").map(c => decryptChar(c)).join(""); for(let e of dom.querySelectorAll(selector)) { console.log(e.textContent); e.textContent = decryptString(e.textContent); console.log(e.textContent); } }

decrypt("qVTPNEAHbykpxiYtlWdOzUGnsMcZXBQuSaRKICJwgFLDefrvhmjo", "span[style*='ZxXoTeIptL']"); decrypt("PwyUBVTYqAXxZMfEjrSeDazCkWoivHJbKltNdLOhupgImQscnFRG", "span[style*='ijqXQijeiD']"); decrypt("dTKbCMwpkGWJrJOUiFVesPoXRfQSmuvqglEyDBLnzIYHAZcaxthN", "span[style*='WTKNOkuWha']"); decrypt("JznCuUZtTgKGAkvwBSOYLHsihaNEPpMVefWRoqlymbjcIXrdQDFx", "span[style*='rnlfJtfRCW']"); decrypt("cHMZtWYfaEipjXbRPLogAFSBDVrOmUNxIlkeCszTuwKhdJnGqQyv", "span[style*='LPJMfkmHKG']"); decrypt("ikvXhpVftrOcGCBaZxgFSwmWEjbAoLePKnTqUDMIyJdRlQuzsYNH","span[style*='UTBCOGYVcD']"); decrypt("HwSjBkqPuabFCNgvlXGiEDpZJURnfKoLATOyQImshtYdWMVrecxz","span[style*='neTnLsdxBa']"); decrypt("EdmCAkeowsNOfGJKbMgTitzIUjLxnrYQZXqcvuylWHDSphRBaFVP","span[style*='LQrKfqvDvK']"); decrypt("YuZqUFnHITMGlebCtQrKLSgfxJvDwsBiaWRkNdEXmOjVzohAycpP","span[style*='qmmADVPJyD']"); decrypt("UaAfIxLRXihODSjvBEFJeZuGTPlWnVQzcyqrHNkmoMKCgbtsdYwp","span[style*='SGBznXcdPC']"); decrypt("jbsUhGHLVKtioYfAnrvTIBdpFOWgMExDRPyXNzeQawZulkSqmcCJ","span[style*='FnKeibFQhj']"); decrypt("FINtlAjGYqeXHKDuPdBhpsWvQnLSJmrbxkyzwZogcfRVOUTECaMi","span[style*='IXiXwzoevW']"); decrypt("CmWkeQxEgfFYuAXHUwpVRGiMvJbBdojPalhrsSZDqLyOKtTNIcnz","span[style*='EvSWqkjBYz']"); decrypt("gjkChAdlBJYOVIxTXnisWLvmyEMtuGzPpaebFDcZoRHSwUrNfqKQ","span[style*='hJrIMhiLIW']");

return true;

bookimp avatar Sep 27 '25 07:09 bookimp

Hi, what script did you use to clean CG? the one I pasted is not working

Marrienneeyy avatar Sep 27 '25 07:09 Marrienneeyy

@bookimp @Marrienneeyy can you please upload a "fresh" problematic epub here: https://nx39171.your-storageshare.de/s/jiXLtaZ8BDpZHM5

with "fresh" i mean an epub that you didn't edit with https://dteviot.github.io/EpubEditor/

gamebeaker avatar Sep 27 '25 07:09 gamebeaker

@bookimp @Marrienneeyy can you please upload a "fresh" problematic epub here: https://nx39171.your-storageshare.de/s/jiXLtaZ8BDpZHM5

with "fresh" i mean an epub that you didn't edit with https://dteviot.github.io/EpubEditor/

Done, I just ran the first 20 chapters for a fresh copy.

bookimp avatar Sep 27 '25 07:09 bookimp

@bookimp i only looked until chapter 5. Both buttons worked for me. In which Chapter is the problem? What viewer do you use? Can you please upload the epubs after you tried to edit them with https://dteviot.github.io/EpubEditor/ and name them "button_Clean_ChrysanthemumGarden.epub" and "button_Link_extra_fonts" (and tell me which chapter is still broken.)

gamebeaker avatar Sep 27 '25 08:09 gamebeaker

@bookimp @Marrienneeyy can you please upload a "fresh" problematic epub here: https://nx39171.your-storageshare.de/s/jiXLtaZ8BDpZHM5

with "fresh" i mean an epub that you didn't edit with https://dteviot.github.io/EpubEditor/

I uploaded it

Marrienneeyy avatar Sep 27 '25 09:09 Marrienneeyy

@Marrienneeyy you didn't use the test version of WebToEpub Test versions for Firefox and Chrome have been uploaded to https://github.com/dteviot/WebToEpub/releases/tag/developer-build. Pick the one suitable for you, follow the "How to install from Source (for people who are not developers)" instructions at https://github.com/dteviot/WebToEpub/tree/ExperimentalTabMode#user-content-installation and let me know how it goes.

Please try it with the test version and than Link extra fonts in the EpubEditor

gamebeaker avatar Sep 27 '25 13:09 gamebeaker

Okay I tested it again after you said it worked, but i tried it again for the same novel : https://chrysanthemumgarden.com/novel-tl/amtwbd/ I have already downloaded the .31 version of webtoepub as well. I tried the clean chysanthemum garden button and the link extra fonts button and they did not work in unscrambling the texts. I can upload the versions I tried as well.

readingthings8-cell avatar Sep 27 '25 16:09 readingthings8-cell

I can upload the versions I tried as well

@readingthings8-cell that would be perfect. (just name them accordingly)

How do you try to read the epub? What is your programm?

gamebeaker avatar Sep 27 '25 16:09 gamebeaker

This script is currently working for me on v.31

function decrypt(clear, selector) { let crypt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; let decryptTable = new Map(); for(let i = 0; i < crypt.length; ++i) { decryptTable.set(crypt[i], clear[i]); } let decryptChar = (c) => decryptTable.get(c) ?? c; let decryptString = (cypherText) => cypherText.split("").map(c => decryptChar(c)).join(""); for(let e of dom.querySelectorAll(selector)) { console.log(e.textContent); e.textContent = decryptString(e.textContent); console.log(e.textContent); } }

decrypt("qVTPNEAHbykpxiYtlWdOzUGnsMcZXBQuSaRKICJwgFLDefrvhmjo", "span[style*='ZxXoTeIptL']"); decrypt("PwyUBVTYqAXxZMfEjrSeDazCkWoivHJbKltNdLOhupgImQscnFRG", "span[style*='ijqXQijeiD']"); decrypt("dTKbCMwpkGWJrJOUiFVesPoXRfQSmuvqglEyDBLnzIYHAZcaxthN", "span[style*='WTKNOkuWha']"); decrypt("JznCuUZtTgKGAkvwBSOYLHsihaNEPpMVefWRoqlymbjcIXrdQDFx", "span[style*='rnlfJtfRCW']"); decrypt("cHMZtWYfaEipjXbRPLogAFSBDVrOmUNxIlkeCszTuwKhdJnGqQyv", "span[style*='LPJMfkmHKG']"); decrypt("ikvXhpVftrOcGCBaZxgFSwmWEjbAoLePKnTqUDMIyJdRlQuzsYNH","span[style*='UTBCOGYVcD']"); decrypt("HwSjBkqPuabFCNgvlXGiEDpZJURnfKoLATOyQImshtYdWMVrecxz","span[style*='neTnLsdxBa']"); decrypt("EdmCAkeowsNOfGJKbMgTitzIUjLxnrYQZXqcvuylWHDSphRBaFVP","span[style*='LQrKfqvDvK']"); decrypt("YuZqUFnHITMGlebCtQrKLSgfxJvDwsBiaWRkNdEXmOjVzohAycpP","span[style*='qmmADVPJyD']"); decrypt("UaAfIxLRXihODSjvBEFJeZuGTPlWnVQzcyqrHNkmoMKCgbtsdYwp","span[style*='SGBznXcdPC']"); decrypt("jbsUhGHLVKtioYfAnrvTIBdpFOWgMExDRPyXNzeQawZulkSqmcCJ","span[style*='FnKeibFQhj']"); decrypt("FINtlAjGYqeXHKDuPdBhpsWvQnLSJmrbxkyzwZogcfRVOUTECaMi","span[style*='IXiXwzoevW']"); decrypt("CmWkeQxEgfFYuAXHUwpVRGiMvJbBdojPalhrsSZDqLyOKtTNIcnz","span[style*='EvSWqkjBYz']"); decrypt("gjkChAdlBJYOVIxTXnisWLvmyEMtuGzPpaebFDcZoRHSwUrNfqKQ","span[style*='hJrIMhiLIW']"); decrypt("fTYOLRFjwlXStDAHdWMPvbCNZgViphqmcezIsEnaBKkUGoyQJxru", "span[style*='SEhBEutKiF']"); decrypt("WKYgbQwVtKPXTLEUjOfzGqyIluSDhCdAvmspcaFJMxRNBriZnoHe", "span[style*='yqYCWpzUCb']"); decrypt("brEnmoWcgHxYPztSshDOIdLiKNupTZVvjGaMwRBUXelqJACQfFky", "span[style*='XteTTFfBwp']"); decrypt("CSeYjPXkzNtQRfyqTrpWGgmEBKinDFJlbUacwvHOIdxushAoLVMZ", "span[style*='XAGRhgiWCi']"); decrypt("vYIDHNKzywBxLTnsZmPJiXEohOVStMAakjpfRQFUGWeqrguCdblc", "span[style*='SAOyHmauIh']"); decrypt("KDoztpYCNRFgMGrLlHiWfbUjdZEmIhxnBkJVTwsuPQqvAcOaSyeX", "span[style*='riwhyYaCJZ']"); decrypt("ymNQsGUILJWBiebxhEoCgjRKHzwZkprtAulnqVFOfcvSPaDTMYdX", "span[style*='obYashdtJI']"); decrypt("UJrjWKXVYmADoqntOCGsSIpFbvPwzuNiaQBycMxhzfElTdLkegHR", "span[style*='lOFLTaIJJX']"); decrypt("LNksIrFykbWwGoezDRlYamcgnBPoEHTVZptQiJXjvdMUqhAfCxSu", "span[style*='JelXiZWjqn']"); decrypt("vSFIJDfnqOcYBixkzjLMAgyNtPQphrHZeTVRUWlKmCsdXEGuwbao", "span[style*='fkIbKbXagm']");

return true;

bookimp avatar Sep 27 '25 17:09 bookimp

@bookimp

The script you've provided is broken. Due to you rotating crypt, decrypt for the older styles won't work. Latest (corrected) script is at https://github.com/dteviot/WebToEpub/issues/2173#issuecomment-3341998757

dteviot avatar Sep 27 '25 19:09 dteviot

Hi Sorry for the late reply, my laptop stopped working for a bit. I just came online and I tried the above steps, I even the ran the new script on epub editor : function decrypt(clear, selector) { let crypt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; let decryptTable = new Map(); for(let i = 0; i < crypt.length; ++i) { decryptTable.set(crypt[i], clear[i]); } let decryptChar = (c) => decryptTable.get(c) ?? c; let decryptString = (cypherText) => cypherText.split("").map(c => decryptChar(c)).join(""); for(let e of dom.querySelectorAll(selector)) { e.removeAttribute("style"); e.textContent = decryptString(e.textContent); console.log("(" + selector + ")" + e.textContent); } }

decrypt("qVTPNEAHbykpxiYtlWdOzUGnsMcZXBQuSaRKICJwgFLDefrvhmjo", "span[style*='ZxXoTeIptL']"); decrypt("PwyUBVTYqAXxZMfEjrSeDazCkWoivHJbKltNdLOhupgImQscnFRG", "span[style*='ijqXQijeiD']"); decrypt("dTKbCMwpkGWJrJOUiFVesPoXRfQSmuvqglEyDBLnzIYHAZcaxthN", "span[style*='WTKNOkuWha']"); decrypt("JznCuUZtTgKGAkvwBSOYLHsihaNEPpMVefWRoqlymbjcIXrdQDFx", "span[style*='rnlfJtfRCW']"); decrypt("cHMZtWYfaEipjXbRPLogAFSBDVrOmUNxIlkeCszTuwKhdJnGqQyv", "span[style*='LPJMfkmHKG']");

decrypt("iKhDSORsAbqBtGNYpecfHQEwklxJlWCmTLjFdzrPXuvVonMygUZa", "span[style*='PWJEddcfVv']"); decrypt("gjkChAdlBJYOVIxTXnisWLvmyEMtuGzPpaebFDcZoRHSwUrNfqKQ", "span[style*='ofcUGYMWCy']"); decrypt("FGqNYQLTPUHecErxRuCjBkDXbMaKyfzOhJdipolAgWItZVsnmSvw", "span[style*='hffmcMyCbf']"); decrypt("upTZvvjGaMwRBUXelqJACQfFkybrEnmoWcgHxYPztSshDOIdLiKN", "span[style*='ktlmWRazmy']"); decrypt("RWOVtgzYjNfXMPQqscdZKwrLlFBCevhHSAEDIpnoGTukibyxamJU", "span[style*='UxneBYgsjE']"); decrypt("uZcQtkAyRnJgxGVTbEXYwOBlWhvmKqoPrjdceHNDpUzfSFMaisIL", "span[style*='XMgbgIppHk']"); decrypt("inDFJlbUacwvHOIdxushAoLVMZCSeYjPXkzNtQRfyqTrpWGgmEBK", "span[style*='lqagMDCZsf']");

decrypt("ikvXhpVftrOcGCBaZxgFSwmWEjbAoLePKnTqUDMIyJdRlQuzsYNH", "span[style*='UTBCOGYVcD']"); decrypt("HwSjBkqPuabFCNgvlXGiEDpZJURnfKoLATOyQImshtYdWMVrecxz", "span[style*='neTnLsdxBa']"); decrypt("EdmCAkeowsNOfGJKbMgTitzIUjLxnrYQZXqcvuylWHDSphRBaFVP", "span[style*='LQrKfqvDvK']"); decrypt("YuZqUFnHITMGlebCtQrKLSgfxJvDwsBiaWRkNdEXmOjVzohAycpP", "span[style*='qmmADVPJyD']"); decrypt("UaAfIxLRXihODSjvBEFJeZuGTPlWnVQzcyqrHNkmoMKCgbtsdYwp", "span[style*='SGBznXcdPC']"); decrypt("jbsUhGHLVKtioYfAnrvTIBdpFOWgMExDRPyXNzeQawZulkSqmcCJ", "span[style*='FnKeibFQhj']"); decrypt("FINtlAjGYqeXHKDuPdBhpsWvQnLSJmrbxkyzwZogcfRVOUTECaMi", "span[style*='IXiXwzoevW']"); decrypt("CmWkeQxEgfFYuAXHUwpVRGiMvJbBdojPalhrsSZDqLyOKtTNIcnz", "span[style*='EvSWqkjBYz']"); decrypt("gjkChAdlBJYOVIxTXnisWLvmyEMtuGzPpaebFDcZoRHSwUrNfqKQ", "span[style*='hJrIMhiLIW']");

decrypt("ViphqmcezIsEnaBKkUGoyQJxrufTYOLRFjwlXStDAHdWMPvbCNZg", "span[style*='SEhBEutKiF']"); decrypt("SDhCdAvmspcaFJMxRNBriZnoHeWKYgbQwVtKPXTLEUjOfzGqyIlu", "span[style*='yqYCWpzUCb']"); decrypt("upTZVvjGaMwRBUXelqJACQfFkybrEnmoWcgHxYPztSshDOIdLiKN", "span[style*='XteTTFfBwp']"); decrypt("inDFJlbUacwvHOIdxushAoLVMZCSeYjPXkzNtQRfyqTrpWGgmEBK", "span[style*='XAGRhgiWCi']"); decrypt("VStMAakjpfRQFUGWeqrguCdblcvYIDHNKzywBxLTnsZmPJiXEohO", "span[style*='SAOyHmauIh']"); decrypt("EmIhxnBkJVTwsuPQqvAcOaSyeXKDoztpYCNRFgMGrLlHiWfbUjdZ", "span[style*='riwhyYaCJZ']"); decrypt("wZkprtAulnqVFOfcvSPaDTMYdXymNQsGUILJWBiebxhEoCgjRKHz", "span[style*='obYashdtJI']"); decrypt("PwzuNiaQBycMxhzfElTdLkegHRUJrjWKXVYmADoqntOCGsSIpFbv", "span[style*='lOFLTaIJJX']"); decrypt("PoEHTVZptQiJXjvdMUqhAfCxSuLNksIrFykbWwGoezDRlYamcgnB", "span[style*='JelXiZWjqn']"); decrypt("QphrHZeTVRUWlKmCsdXEGuwbaovSFIJDfnqOcYBixkzjLMAgyNtP", "span[style*='fkIbKbXagm']");

return true;

However, it still hasn't unscrambled the text for me. I tried the link fonts button and the clean chysanthemum garden button as well. Is there anywhere I can link the files that I've done to show the problem?

readingthings8-cell avatar Sep 30 '25 15:09 readingthings8-cell

They've added an encryption since yesterday, the button worked for me then but doesn't now.

bookimp avatar Sep 30 '25 17:09 bookimp

@readingthings8-cell

Steps to self-help.

  1. Use latest test version https://github.com/dteviot/WebToEpub/releases/tag/developer-build of WebToEpub to capture epub.
  2. Drop epub into EpubEditor and click "Clean ChrysanthemunGarden" button. Save result.
  3. Refresh EpubEditor and drop the new epub into the EpubEditor.
  4. Open DevTools in the browser and go to "Console" tab
  5. Drop script from https://github.com/dteviot/EpubEditor/commit/336b05a627ad542f5fba25c71c652d67b4466a45 into right window and click ""Run script above to modify epub". Do NOT save the results. The console window will show any new cyphers.
  6. If new cyphers are shown, the first thing you can try is clicking the bottom "Link extra fonts (ChysanthenumGarden, requiremtls, etc.)" button. and save the results.
  7. This MAY work, depending on the epub viewer you have.
  8. If it does not work, you can use the steps https://github.com/dteviot/WebToEpub/issues/2173#issuecomment-3296153047 to figure out the keys for the new cyphers.
  9. Alternately, the fonts that have the cyphers should have been packed into the epub. If you unzip the epub, you can then drop them into https://opentype.js.org/glyph-inspector.html to view the characters and get the key. Note, order of upper case vs. lower case are reversed in the viewer compared to the key. So you'll need to swap the first 26 characters with the 2nd 26 if you use this method.
  10. After cacluating the keys, add them to the script above and run in EpubEditor.

dteviot avatar Oct 01 '25 06:10 dteviot

Hi, after trying the first method, it just didn't work and the second method is not working for me as well. I guess, I'll just manually re-type the gibberish in calibre but thanks for your help anyways

readingthings8-cell avatar Oct 07 '25 08:10 readingthings8-cell

Duplicate. See: https://github.com/dteviot/WebToEpub/issues/2173 Self-help: https://github.com/dteviot/EpubEditor/wiki

dteviot avatar Jan 01 '26 02:01 dteviot