diff --git a/application/static/datasource.html b/application/static/datasource.html index 123b48d..7d63b4b 100644 --- a/application/static/datasource.html +++ b/application/static/datasource.html @@ -7,32 +7,31 @@ To build a data source, firstly purchase a matching audible & kindle book (typic
To convert an audible audio book to an audio file (.mp3) I use AaxAudioConverter. Here are the steps to install and use:
To convert a kindle book to text file (.txt) I developed an extension found in the dataset folder of this project. Here are the steps to install and use:
+To convert a kindle book to text file (.txt):
-
-
+
If this doesn't work you can also follow the DeDRM guide
{% endblock %} diff --git a/application/static/images/kindle_step3.PNG b/application/static/images/kindle_step3.PNG new file mode 100644 index 0000000..fc09fb6 Binary files /dev/null and b/application/static/images/kindle_step3.PNG differ diff --git a/application/static/images/step2.PNG b/application/static/images/step2.PNG deleted file mode 100644 index bb68848..0000000 Binary files a/application/static/images/step2.PNG and /dev/null differ diff --git a/application/static/images/step4.PNG b/application/static/images/step4.PNG deleted file mode 100644 index 7f1321f..0000000 Binary files a/application/static/images/step4.PNG and /dev/null differ diff --git a/application/static/images/step5.PNG b/application/static/images/step5.PNG deleted file mode 100644 index 0fd8b99..0000000 Binary files a/application/static/images/step5.PNG and /dev/null differ diff --git a/dataset/extension/main.js b/dataset/extension/main.js deleted file mode 100644 index 3b783e9..0000000 --- a/dataset/extension/main.js +++ /dev/null @@ -1,104 +0,0 @@ -document.addEventListener('DOMContentLoaded', function() { - var convert = document.getElementById('scrapeBook'); - var download = document.getElementById('exportBook'); - - convert.addEventListener('click', function() { - function getBook(){ - function scrapePage(){ - function hashString(str){ - let hash = 0; - for (let i = 0; i < str.length; i++) { - hash += Math.pow(str.charCodeAt(i) * 31, str.length - i); - hash = hash & hash; // Convert to 32bit integer - } - return hash; - } - - var hashes = {}; - var content = []; - function addDiv(div){ - let hash = hashString(div.innerText); - if (hashes[hash] === undefined) { - hashes[hash] = true; - content.push(div.outerHTML); - } - } - - var appFrame = document.querySelector('#KindleReaderIFrame').contentDocument; - var contentFrames = Array.from(appFrame.querySelectorAll('iframe')).map(f => f.contentDocument); - Array.from(contentFrames[1].querySelectorAll('body > div')).forEach(addDiv); - appFrame.getElementById('kindleReader_pageTurnAreaRight').click(); - return content; - } - - function extractContent(s) { - var span = document.createElement('span'); - span.innerHTML = s; - return span.textContent || span.innerText; - } - - function getFooter(){ - var appFrame = document.querySelector('#KindleReaderIFrame').contentDocument; - return appFrame.getElementById("kindleReader_footer_message").innerHTML.split(" "); - } - - function getCurrentPageNumber(){ - var footer = getFooter(); - return parseInt(footer[3]); - } - - var footer = getFooter(); - var num_pages = parseInt(footer[5]); - var current_page = parseInt(footer[3]); - var book = ""; - var last_page = ""; - - function getPageText(){ - text = "\n\n"; - page = scrapePage(); - for (let i = 0; i < page.length; i++){ - text += extractContent(page[i]) + "\n"; - } - if(text != last_page){ - book += text; - last_page = text; - } - current_page = getCurrentPageNumber(); - if(current_page == num_pages){ - alert("Extracted "+num_pages+" pages"); - var data = document.getElementById("data"); - if(data){ - data.innerHTML = book; - } else { - document.body.innerHTML += ""+book+""; - } - return; - } - setTimeout(getPageText, 1000); - } - - getPageText(); - return text; - } - - chrome.tabs.executeScript({ - code: '(' + getBook + ')();' - }, (result) => { - console.log(result); - }); - }, false); - - download.addEventListener('click', function() { - chrome.tabs.executeScript({ - code: '(function getData(){ return document.getElementById("data").innerHTML; })();' - }, (result) => { - console.log(result); - var blob = new Blob([result], {type: "text/plain"}); - var url = URL.createObjectURL(blob); - chrome.downloads.download({ - url: url, - filename: "book.txt" - }); - }); - }, false); -}, false); diff --git a/dataset/extension/manifest.json b/dataset/extension/manifest.json deleted file mode 100644 index ee26cf6..0000000 --- a/dataset/extension/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "manifest_version": 2, - "name": "Kindle webscraper", - "description": "This extension scrapes kindle books for the purpose of voice cloning", - "version": "1.0", - "browser_action": { - "default_popup": "popup.html" - }, - "permissions": ["downloads", "https://read.amazon.co.uk/*", "https://read.amazon.com/*", "cookies"] -} diff --git a/dataset/extension/popup.html b/dataset/extension/popup.html deleted file mode 100644 index b3c93a6..0000000 --- a/dataset/extension/popup.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -