From 87de46ff91a173480956261ddcfc0ace849add81 Mon Sep 17 00:00:00 2001 From: Hady Osman Date: Wed, 17 Nov 2021 00:09:55 +1300 Subject: [PATCH] Fix meta data scraping regression Amazon markup started containing non-alpha numeric characters that broke the scraping --- manifest.json | 2 +- package.json | 2 +- src/scraper/scrapeBookMetadata.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index cb80be8..52e302f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-kindle-plugin", "name": "Kindle Highlights", - "version": "1.4.0", + "version": "1.4.1", "minAppVersion": "0.10.2", "description": "Sync your Kindle book highlights using your Amazon login or uploading your My Clippings file", "author": "Hady Osman", diff --git a/package.json b/package.json index baac607..22e72ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-kindle-plugin", - "version": "1.4.0", + "version": "1.4.1", "description": "Sync your Kindle book highlights using your Amazon login or uploading your My Clippings file", "main": "src/index.ts", "repository": { diff --git a/src/scraper/scrapeBookMetadata.ts b/src/scraper/scrapeBookMetadata.ts index d124410..82f6cfa 100644 --- a/src/scraper/scrapeBookMetadata.ts +++ b/src/scraper/scrapeBookMetadata.ts @@ -12,7 +12,8 @@ const parseDetailsList = ($: Root): Omit => { const key = $('span:first-child', currentEl) .text() .replace(/[\n\r]+/g, '') - .replace(':', ''); + .replace(':', '') + .replace(/[^\w\s]/gi, ''); // Strip all chars except alpha numeric and spaces const value = $('span:nth-child(2)', currentEl).text();