Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tutorial] Code changes to support for older Kindle devices #17

Closed
anuraagdjain opened this issue Jan 30, 2023 · 2 comments
Closed

[Tutorial] Code changes to support for older Kindle devices #17

anuraagdjain opened this issue Jan 30, 2023 · 2 comments

Comments

@anuraagdjain
Copy link
Contributor

I have an older kindle (d01200) and the current regex was unable to capture the data from the clippings file. Below are the changes one could do to sync their data to Notion.

// src/models/parser.ts

private regex =
    /(.+) \((.+)\)\r*\n- Your Highlight (location|Location|page)( |(.+))([0-9]+)-([0-9]+) \| Added on ([a-zA-Z]+), ([a-zA-Z]+|[0-9]+) ([0-9]+|[a-zA-Z]+),? ([0-9]{4}), ([0-9]+):([0-9]+\s? A?P?M?)\r*\n\r*\n(.+)/gm;
    
// src/models/parser.ts line 38-39

const time = `${match[12]}:${match[13]}`;
const highlight = match[14];    

Input data looks something like below:

No Rules Rules (Reed Hastings;Erin Meyer)
- Your Highlight Location 2620-2620 | Added on Sunday, January 22, 2023, 08:20 PM

farm for dissent, socialize the idea, and for big bets, test it out. 
==========
No Rules Rules (Reed Hastings;Erin Meyer)
- Your Highlight Location 3725-3725 | Added on Saturday, January 28, 2023, 05:10 AM

Erin’s book, The Culture Map. 
==========

Thanks to @arkalim for making this project. Solves the most crucial piece for me, just had to fix the regex for my device.

@anuraagdjain
Copy link
Contributor Author

Closing this issue because it's a guide and not an issue. Not sure if the author wants to support older devices, but will be helpful for others.

@arkalim
Copy link
Owner

arkalim commented Jan 30, 2023

If there's a way to determine the version in code and apply the regex accordingly, you can implement it and raise a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants