Roger-Wu / remove-apple-books-citation

some python scripts to remove citation when copying from Apple Books
5 stars 0 forks source link

Text is cut off #2

Open liketheduck opened 1 year ago

liketheduck commented 1 year ago

A normal copy/paste will return the full text selected (with citation). But using the python script the double-quotes and citation are removed, but the output text is also cut short , ending mid-sentence.

Update: Looks like it's a limitation of books. When using this method, books only gives a partial citation. So you need to copy the contents normally, then run the shortcut on the clipboard's text.

Train100 commented 1 month ago

@liketheduck Do you mind sharing how you modified the quick action? I tried to add another 'Copy to Clipboard' step at the beginning of the workflow to copy the regular text, then run the script before copying the output of the script, but the text is still cut off.

liketheduck commented 1 month ago

@liketheduck Do you mind sharing how you modified the quick action? I tried to add another 'Copy to Clipboard' step at the beginning of the workflow to copy the regular text, then run the script before copying the output of the script, but the text is still cut off.

This is my python script:

import sys

data = sys.stdin.read()

remove_citation = data.split('“',1)[1].rsplit('”',1)[0]
print(remove_citation)

I trigger it with a Keyboard shortcut after it is in my clipboard. You know it works successfully if you in you paste it there is no citation (but if you paste it before running the shortcut there is a citation). It creates no visible output other than that. It has been a year since I created it so I don't remember step by step. I hope this helps!