GithubHelp home page GithubHelp logo

nicohaenggi / safaribooks-downloader Goto Github PK

View Code? Open in Web Editor NEW
510.0 29.0 106.0 229 KB

a SafariBooksOnline downloader that generates respective .epub books for offline and kindle reading

Home Page: https://learning.oreilly.com/

License: MIT License

JavaScript 10.90% HTML 89.10%
epub-generator safaribooks-downloader safaribooksonline oreilly-books-downloader oreilly

safaribooks-downloader's Introduction

SafariBooks Downloader & ePub Generator

SafariBooks-Downloader is a project created and maintained by Nico Haenggi.

The project is currently setup in two branches.

  • master also known as stable - The ePub generator 'should' be stable on this branch, and is generally well tested
  • dev also known as unstable - The ePub generator is being developed on this branch, and is not always well tested and stable

Support

If you discover a bug in the generator, please search the issue tracker first. If it hasn't been reported, please create a new issue.

If you have a great idea to improve the generator, please search the feature tracker first to ensure someone else hasn't already come up with the same great idea. If it hasn't been requested, please create a new request. While you're there vote on other feature requests to let the me know what is most important to you.

If you'd like to make your own changes ensure your Pull Request is made against the dev branch.

Installation Guide

How To Install

Install Node.js. We recommend the LTS release. The SafariBooks-Downloader has been tested on most node versions between v4.4.5 and v.6.9.5 and should therefore cause no problems running on one of these versions. For more information about how to install it on your environment, see Installing Node.js via package manager. To verify your installation, run:

node -v

If a version is returned, you did successfully install Node.js. Next up, make sure npm is properly installed. To verify, run:

npm -v

If the command returns a version number, you're all set. Next, we'll clone the repository.

git clone https://github.com/nicohaenggi/SafariBooks-Downloader.git
cd SafariBooks-Downloader

Install all the dependencies with npm.

npm install

Congratulations! You've successfully installed SafariBooks-Downloader. If you desire to do so, you can install the tool globally on your machine. To do so, run:

npm install -g

To verify the installation, please run:

safaribooks-downloader --version

If the command returns a version number, you have successfully installed the tool globally. The current release is v1.0.0.

How To Update

  1. Stop the downloader if it's running. (use control + c to stop it)
  2. Run git pull
    This will update the generator to the latest master branch
  3. Reinstall dependencies with npm install or npm install -g
    using npm install -g will install the generator globally
  4. Run safaribooks-downloader --version
    After you are done following it this will print out the current version of the generator.

How To Run

The tool provides the following six options. The options --bookid, --username, --password and --output are required. However, if the username and password options are provided once, they will be cached and are no longer required to run the CLI.

Options

  • -h, --help
    • displays usage information
  • -V, --version
    • displays version number
  • -b, --bookid
    • the book id of the SafariBooksOnline ePub to be generated you can find the book id by having a look at the URL while reading the book e.g. https://www.safaribooksonline.com/library/view/building-apis-with/9781484224427/A435096_1_En_7_Chapter.html whereas the id will be 9781484224427
  • -u, --username
    • username of the SafariBooksOnline user - must have a paid/trial membership, otherwise will not be able to access the books
  • -p, --password
    • password of the SafariBooksOnline user
  • -o, --output
    • output path the epub file should be saved to. On some systems, the path may require to contains no whitespaces.
  • -d, --debug
    • enable debug mode for request package.

Example

An example showing how a SafariBooksOnline with id 9781484224427 is downloaded and converted into a ePub file testbook.epub.

safaribooks-downloader -b 9781484224427 -u nicohaenggi -p MySuperSecurePassword -o /Users/nicohanggi/Desktop/testbook.epub

An example showing how a SafariBooksOnline with id 9892595335538 is downloaded and converted into a ePub file testdebugbook.epub.

safaribooks-downloader -d -b 9781484224427 -u nicohaenggi -p MySuperSecurePassword -o /Users/nicohanggi/Desktop/testbook.epub

Features

  • generating ePub with cover image, authors and publisher
  • custom stylesheets will be imported (only one currently)
  • support for several different stylesheets in one book
  • directly generating .mobi files

Credits

  • Nico Haenggi: conception & development
  • cyrilis: a big thanks to cyrillis for his epub-gen package which I relied upon heavily while integrating my own epub generator

Copyright & License

Copyright (c) 2017 Nico Haenggi - Released under the MIT License

safaribooks-downloader's People

Contributors

dependabot[bot] avatar hypr2771 avatar nicohaenggi avatar stochasticowl avatar zfields avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

safaribooks-downloader's Issues

All books returning 404?

Hi,

Just recently books started returning 404:

$ safaribooks-downloader -u user -p "password" -o ./books/book.epub -b id
[safari-downloader] starting application...
[safari-downloader] the user "[email protected]" was successfully authorized...
[safari-downloader] StatusCodeError: 404 - {}

This is happening for all books I try.

Download images

Hi, great work :) I wanted to ask if there is the possibility to embed the images of the book into the epub file?

We couldn't open the book

When I complete downloaded the book and open it with Microsoft Edge , only show the message " We couldn't open the book" . What happened ?

SyntaxError: Unexpected end of JSON input

After a few download that working properly, i get this error message every time i try to download.

undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/home/user_name/SafariBooks-Downloader/lib/cli/index.js:27:28)
    at Module._compile (internal/modules/cjs/loader.js:736:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
    at Function.Module._load (internal/modules/cjs/loader.js:560:3)
    at Module.require (internal/modules/cjs/loader.js:665:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/user_name/SafariBooks-Downloader/index.js:11:18)
    at Module._compile (internal/modules/cjs/loader.js:736:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
    at Function.Module._load (internal/modules/cjs/loader.js:560:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
    at executeUserCode (internal/bootstrap/node.js:526:15)
    at startMainThreadExecution (internal/bootstrap/node.js:439:3)

client id and secret

Hello,
Whose clientid and secret are being used in the application ? if you want to use your own, how do obtain one ?

from safari/index.js
this.clientSecret = "f52b3e30b68c1820adb08609c799cb6da1c29975";
this.clientId = "446a8a270214734f42a7";

thanks

Not able to install globally, please help its urgent.

I am not able install the command globally, so please help with exact steps.
image

I have tried uninstall, re-install etc etc So, please help me with exact steps.

And,
git clone <LINK>
Please let me know the value of LINK as well ?

ACM accounts

I have an account with ACM with which I can use to access Safari Books, but I can't use it with the downloader. Probably because of the fact that I get redirected to enter my ACM credentials.

Stuck at download a book

It stucks here, this book have 1000 pages.
but it works fine with books with around 200 pages.

capture

SOLVED: It just needs more time :D

Use without credentials

I believe it should be possible to download a book without credentials if it is possible to view it without credentials - solely based on IP address. Just providing your script with fake credentials does not work for obvious reasons. Do you think adding an option to not use credentials? (I'm not sure if it makes a difference. I was trying to download a book from the proquest.safaribooksonline.com subdomain)

[safari-downloader] an error occurred while trying to download all the image assets (err: RequestError: getaddrinfo ENOTFOUND www.safaribooksonline.com www.safaribooksonline.com:443)

I got this error while downloading few of the books

[safari-downloader] downloaded meta files...
[safari-downloader] downloaded table of content files...
[safari-downloader] downloaded chapter files...
[safari-downloader] an error occurred while fetching stylesheets. there are 3 different stylesheets. only supporting one. the layout may be different from the one online. sorry for that.
[safari-downloader] downloaded stylesheet files...
[safari-downloader] an error occurred while trying to download all the image assets (err: RequestError: getaddrinfo ENOTFOUND www.safaribooksonline.com www.safaribooksonline.com:443)

pdf support?

Currently, this application only supports epub for output format.
PDF support?

Invalid Credentials

I'm trying to download a book with the help of the guidelines mentioned in the documentation. Below is the code which I'm running:
safaribooks-downloader -b 97777777777777 -u [email protected] -p password -o ~/book.epub

I'm getting the below error:
[safari-downloader] starting application...
[safari-downloader] StatusCodeError: 400 - {"error":"invalid_grant","error_description":"Invalid credentials given."}

As per the error description, it's not the case, as I'm giving the correct credentials.
Note: The Safari-Books Online account is a Personal Trial Account.

Error 403

$ safaribooks-downloader -b 9781492054498 -u [email protected] -p xxxxx -o testbook.epub
[safari-downloader] starting application...
[safari-downloader] the user "[email protected]" was successfully authorized...
[safari-downloader] StatusCodeError: 403 - {"detail":"You do not have permission to perform this action."}

i checked my account and i can open any book by webpage

ETIMEDOUT on some books

C:\dev\SafariBooks-Downloader-master>safaribooks-downloader -b 9781787125933 -o "Python Machine Learning.epub"
[safari-downloader] starting application...
[safari-downloader] the user "[email protected]" was successfully authorized...
[safari-downloader] downloaded meta files...
[safari-downloader] downloaded table of content files...
[safari-downloader] downloaded chapter files...
[safari-downloader] downloaded stylesheet files...
[safari-downloader] an error occurred while trying to download all the image assets (err: RequestError: connect ETIMEDOUT 151.101.13.132:443)

[Bug] Getting Invalid Credentials Given Error

I am trying with correct credentials but its giving me Invalid Credentials Given Error.

StatusCodeError: 400 - {"error":"invalid_grant","error_description":"Invalid credentials given."}

My account uses SSO

Hi,

My account uses single sign on. So when I am giving credentials it is saying invalid credentials.

Request your support in how to troubleshoot this issue.

General Query

Very sorry to come back over here for answer, pardon me /\
Just one quick question.
Does an epub file require internet connection for all of the (including images, links etc) contents to load?

Error 302

{ request:
{ debugId: 1,
uri: 'https://www.safaribooksonline.com/oauth2/access_token/',
method: 'POST',
headers:
{ host: 'www.safaribooksonline.com',
'content-type': 'application/x-www-form-urlencoded',
accept: 'application/json',
'content-length': 164 },
body:

{ response:
{ debugId: 1,
headers:
{ 'content-type': 'text/html',
location: 'https://www.oreilly.com/oauth2/access_token/',
'content-length': '0',
'accept-ranges': 'bytes',
date: 'Mon, 01 Apr 2019 20:44:10 GMT',
via: '1.1 varnish',
connection: 'close',
'x-client-ip': '200.87.95.220',
'x-served-by': 'cache-scl19420-SCL',
'x-cache': 'MISS',
'x-cache-hits': '0',
'x-timer': 'S1554151450.906593,VS0,VE191' },
statusCode: 302,
body: undefined } }
[safari-downloader] StatusCodeError: 302 - undefined

SSO support

I have a SSO account setup with Safari, so I can't specify a password. When logging into Safari, after typing in my email I am redirected to my SSO screen to login with my credentials. Ultimately would love some form of being able to specify that I use SSO and have SafariBooks-Downloader pop up a browser window for me to log in and capture the cookie returned for subsequent requests.

Bug

get-safari 9781785280849 "Scala and Spark for Big Data Analytics"                       ✔  5653  01:20:42
[safari-downloader] starting application...
[safari-downloader] the user "[email protected]" was successfully authorized...
[safari-downloader] downloaded meta files...
[safari-downloader] downloaded table of content files...
[safari-downloader] StatusCodeError: 503 - "\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n<!DOCTYPE html>\n<html lang='en'>\n<head>\n<title>Site unavailable</title>\n<meta charset='UTF-8'>\n<meta name='description' content='Error page for Safari'/>\n<link href='https://fonts.googleapis.com/css?family=Source+Sans Pro:200italic,200,300italic,300,400italic,400,600italic,600,700italic,700,900italic,900' rel='stylesheet' type='text/css'>\n<link href='https://storage.googleapis.com/safari-fastly-objects/css/error.css' rel='stylesheet' type='text/css'>\n<meta name='viewport' content='width=device-width, initial-scale=1.0'>\n<script>\n  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n  ga('create', 'UA-39299553-7', 'auto');\n  ga('send', 'pageview');\n  ga('send', 'event', 'Error', 'Varnish', '900', {'nonInteraction': 1});\n</script>\n<style>\n  body {\n    margin: 0;\n  }\n  header {\n    background-color: #b9002d;\n    padding:7px 0 6px 10px;\n    margin-bottom: 15px;\n    text-align: left;\n  }\n  header svg {\n    fill: #fff;\n    display: block;\n    width: 73px;\n    height: 13px;\n  }\n  h1 {\n    font-size: 3em;\n    max-width: 800px;\n    line-height: 1em;\n    margin-bottom: 20px;\n  }\n  h2 {\n    font-size: 2em;\n    max-width: 800px;\n    margin-bottom: 40px;\n  }\n @media (max-width: 600px) {\n   h1 {\n      font-size: 2em;\n       max-width: 75%;\n    }\n    h2 {\n      font-size: 1.5em;\n    }\n  }\n  h1,\n  h2 {\n    font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;\n    font-weight: 200;\n    color: #695545;\n    padding: 0 20px 0;\n  }\n  a, a:link, a:active, a:hover, a:visited {\n    color: #4a3c31;\n  }\n</style>\n</head>\n<body>\n<header>\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 10\" width=\"78\" height=\"13\"><desc>O'Reilly logo</desc><polygon points=\"28.09 1.96 28.09 0.42 21.68 0.42 21.68 9.64 28.09 9.64 28.09 8.11 23.22 8.11 23.22 5.8 27.86 5.8 27.86 4.27 23.22 4.27 23.22 1.96 28.09 1.96\"></polygon><polygon points=\"32.85 9.64 32.85 0.42 34.39 0.42 34.39 8.11 38.82 8.11 38.82 9.64 32.85 9.64\"></polygon><polygon points=\"40.07 9.64 40.07 0.42 41.61 0.42 41.61 8.11 46.04 8.11 46.04 9.64 40.07 9.64\"></polygon><rect x=\"29.71\" y=\"0.42\" width=\"1.54\" height=\"9.22\"></rect><path d=\"M1.59,6.28a4.8,4.8,0,1,1,4.8,4.8,4.8,4.8,0,0,1-4.8-4.8M4.09,4A3.27,3.27,0,1,0,6.4,3,3.27,3.27,0,0,0,4.09,4\" transform=\"translate(-1.59 -1.2)\"></path><path d=\"M19.82,6.89A2.69,2.69,0,0,0,19,1.62H14.41v9.22h1.54V7h2.14l2.32,3.84H22.2ZM15.95,5.47V3.16H19a1.15,1.15,0,0,1,0,2.31h-3.1Z\" transform=\"translate(-1.59 -1.2)\"></path><path d=\"M13.32,2.61a1.13,1.13,0,1,1-1.13-1.13,1.13,1.13,0,0,1,1.13,1.13\" transform=\"translate(-1.59 -1.2)\"></path><polygon points=\"52.9 0.42 51.03 0.42 48.66 3.85 46.3 0.42 44.43 0.42 47.89 5.44 47.89 9.64 49.43 9.64 49.43 5.44 52.9 0.42\"></polygon><path d=\"M58.31,1.2a2.41,2.41,0,1,0,2.41,2.42A2.42,2.42,0,0,0,58.31,1.2m0,4.44a2,2,0,1,1,2-2,2,2,0,0,1-2,2\" transform=\"translate(-1.59 -1.2)\"></path><path d=\"M59.4,3.09a0.72,0.72,0,0,0-.72-0.72H57.32V4.83h0.41v-1h0.69l0.49,1h0.46l-0.51-1a0.71,0.71,0,0,0,.54-0.69m-1.67-.31h0.95a0.31,0.31,0,0,1,.31.31,0.31,0.31,0,0,1-.31.3H57.73V2.78Z\" transform=\"translate(-1.59 -1.2)\"></path></svg>\n</header>\n<section>\n\n  <h1>Houston, we have a problem.</h1>\n\n  <h2>Sorry for the inconvenience. Please try again. For additional help, please contact our customer service team at <a href=\"tel:+1-800-889-8969\" aria-label=\"1. 8 0 0. 8 8 9. 8 9 6 9.\" style=\"white-space:nowrap;\">1-800-889-8969</a>, <a href=\"tel:+1-707-827-7019\" aria-label=\"7 0 7. 8 2 7. 7 0 1 9.\" style=\"white-space:nowrap;\">707-827-7019</a>, or <a href=\"mailto:[email protected]\">[email protected]</a></h2>\n\n  <img src='https://storage.googleapis.com/safari-fastly-objects/img/cog.png' />\n  </section>\n</body>\n</html>\n"

It works for other books, just this one is buggy.

couldn't install

$ node -v
v8.7.0
$ npm -v
5.4.2
$ npm install
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.

added 163 packages in 7.251s
$ safaribooks-downloader --version
-bash: safaribooks-downloader: command not found

No Table of Contents

Unable to display ToC in Edge's built in ToC viewer. Happened once out of two instances of different books

RequestError: Error: certificate is not yet valid

safaribooks-downloader -b 9781484224427 -u nicohaenggi -p MySuperSecurePassword -o /Users/wasuser/Desktop/was.epub
[safari-downloader] starting application...
[safari-downloader] RequestError: Error: certificate is not yet valid

When trying to download immediately the app throws error

Problems with repeated image filenames in different chapters

Some books use image names like inline001.gif in every chapter, and that causes problems, as they overwrite each other.

I have made a quick fix, that seems to work, but it is not very elegant.

--- a/lib/ebook-writer/index.js
+++ b/lib/ebook-writer/index.js
@@ -91,7 +91,7 @@ function _writeChapters(that) {
var newLocation = image;
if(pathArray.length > 1) {
// ### overwriting new path

  •    newLocation = pathArray[pathArray.length -1];
    
  •    newLocation = chapter.fileName+pathArray[pathArray.length -1];
     }
     chapterContent = chapterContent.replace(re, `"images/${newLocation}"`);
    
    });
    @@ -375,7 +375,7 @@ function _prepareImages(that) {
    var newLocation = image;
    if(pathArray.length > 1) {
    // ### overwriting new path
  •    newLocation = pathArray[pathArray.length -1];
    
  •    newLocation =  chapter.fileName+pathArray[pathArray.length -1];
     }
     images.push({ baseUrl: baseUrl, file: image, media: mime.lookup(image), path: newLocation });
    
    });

Download 503 error

Hi I am getting this error for some books (e.g. 9781787281868, 9781788398237, 9781787128453) some others works fine.

[safari-downloader] downloaded meta files... [safari-downloader] downloaded table of content files... [safari-downloader] StatusCodeError: 503 - "\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n<!DOCTYPE html>\n<html lang='en'>\n<head>\n<title>Site unavailable</title>\n<meta charset='UTF-8'>\n<meta name='description' content='Error page for Safari'/>\n<link href='https://fonts.googleapis.com/css?family=Source+Sans Pro:200italic,200,300italic,300,400italic,400,600italic,600,700italic,700,900italic,900' rel='stylesheet' type='text/css'>\n<link href='https://storage.googleapis.com/safari-fastly-objects/css/error.css' rel='stylesheet' type='text/css'>\n<meta name='viewport' content='width=device-width, initial-scale=1.0'>\n<script>\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', 'UA-39299553-7', 'auto');\n ga('send', 'pageview');\n ga('send', 'event', 'Error', 'Varnish', '503', {'nonInteraction': 1});\n</script>\n<style>\n body {\n margin: 0;\n }\n header {\n background-color: #b9002d;\n padding:7px 0 6px 10px;\n margin-bottom: 15px;\n text-align: left;\n }\n header svg {\n fill: #fff;\n display: block;\n width: 73px;\n height: 13px;\n }\n h1 {\n font-size: 3em;\n max-width: 800px;\n line-height: 1em;\n margin-bottom: 20px;\n }\n h2 {\n font-size: 2em;\n max-width: 800px;\n margin-bottom: 40px;\n }\n @media (max-width: 600px) {\n h1 {\n font-size: 2em;\n max-width: 75%;\n }\n h2 {\n font-size: 1.5em;\n }\n }\n h1,\n h2 {\n font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;\n font-weight: 200;\n color: #695545;\n padding: 0 20px 0;\n }\n a, a:link, a:active, a:hover, a:visited {\n color: #4a3c31;\n }\n</style>\n</head>\n<body>\n<header>\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 10\" width=\"78\" height=\"13\"><desc>O'Reilly logo</desc><polygon points=\"28.09 1.96 28.09 0.42 21.68 0.42 21.68 9.64 28.09 9.64 28.09 8.11 23.22 8.11 23.22 5.8 27.86 5.8 27.86 4.27 23.22 4.27 23.22 1.96 28.09 1.96\"></polygon><polygon points=\"32.85 9.64 32.85 0.42 34.39 0.42 34.39 8.11 38.82 8.11 38.82 9.64 32.85 9.64\"></polygon><polygon points=\"40.07 9.64 40.07 0.42 41.61 0.42 41.61 8.11 46.04 8.11 46.04 9.64 40.07 9.64\"></polygon><rect x=\"29.71\" y=\"0.42\" width=\"1.54\" height=\"9.22\"></rect><path d=\"M1.59,6.28a4.8,4.8,0,1,1,4.8,4.8,4.8,4.8,0,0,1-4.8-4.8M4.09,4A3.27,3.27,0,1,0,6.4,3,3.27,3.27,0,0,0,4.09,4\" transform=\"translate(-1.59 -1.2)\"></path><path d=\"M19.82,6.89A2.69,2.69,0,0,0,19,1.62H14.41v9.22h1.54V7h2.14l2.32,3.84H22.2ZM15.95,5.47V3.16H19a1.15,1.15,0,0,1,0,2.31h-3.1Z\" transform=\"translate(-1.59 -1.2)\"></path><path d=\"M13.32,2.61a1.13,1.13,0,1,1-1.13-1.13,1.13,1.13,0,0,1,1.13,1.13\" transform=\"translate(-1.59 -1.2)\"></path><polygon points=\"52.9 0.42 51.03 0.42 48.66 3.85 46.3 0.42 44.43 0.42 47.89 5.44 47.89 9.64 49.43 9.64 49.43 5.44 52.9 0.42\"></polygon><path d=\"M58.31,1.2a2.41,2.41,0,1,0,2.41,2.42A2.42,2.42,0,0,0,58.31,1.2m0,4.44a2,2,0,1,1,2-2,2,2,0,0,1-2,2\" transform=\"translate(-1.59 -1.2)\"></path><path d=\"M59.4,3.09a0.72,0.72,0,0,0-.72-0.72H57.32V4.83h0.41v-1h0.69l0.49,1h0.46l-0.51-1a0.71,0.71,0,0,0,.54-0.69m-1.67-.31h0.95a0.31,0.31,0,0,1,.31.31,0.31,0.31,0,0,1-.31.3H57.73V2.78Z\" transform=\"translate(-1.59 -1.2)\"></path></svg>\n</header>\n<section>\n\n <h1>Houston, we have a problem.</h1>\n\n <h2>Sorry for the inconvenience. Please try again. For additional help, please contact our customer service team at <a href=\"tel:+1-800-889-8969\" aria-label=\"1. 8 0 0. 8 8 9. 8 9 6 9.\" style=\"white-space:nowrap;\">1-800-889-8969</a>, <a href=\"tel:+1-707-827-7019\" aria-label=\"7 0 7. 8 2 7. 7 0 1 9.\" style=\"white-space:nowrap;\">707-827-7019</a>, or <a href=\"mailto:[email protected]\">[email protected]</a></h2>\n\n <img src='https://storage.googleapis.com/safari-fastly-objects/img/cog.png' />\n </section>\n</body>\n</html>\n"

Scrolling in Calibre is diagonal

Hello!

I have found that when reading the epub book in Calibre, the book scrolls down the chapters, but the pages move diagonally to the left, then when the page reaches the far left, the next one starts from the right and the process repeats. Have you ran into this before when attempting to read the EPUB books?

I'd love some help if possible!

Download fails with StatusCodeError: 302 - undefined

attempting to execute the following results in StatusCodeError: 302 - undefined

This is caused by the incorrect baseurl in index.js (as resolved by #54)

safaribooks-downloader -b 9781449368098 -u removed -p removed -o E:\DATA\EBOOKS\testbook.epub
debug

Download fails with RequestError

I have executed the following command:

node index.js -b 9781787286382 -u [email protected] -p mypassword -o .

The output is:

[safari-downloader] starting application...
[safari-downloader] the user "[email protected]" was successfully authorized...
[safari-downloader] downloaded meta files...
[safari-downloader] downloaded table of content files...
[safari-downloader] RequestError: Error: getaddrinfo EAI_AGAIN www.safaribooksonline.com:443

Operating System: Linux my-uname 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
NPM version: 3.5.2
Nodejs version: 4.2.6

how to setup proxy

Hy guys, is there is a way to setup a proxy, problems with conexion. thanks,

there are 2 different stylesheets

[safari-downloader] the user "[email protected]" was successfully authorized...
[safari-downloader] downloaded meta files...
[safari-downloader] downloaded table of content files...
[safari-downloader] downloaded chapter files...
[safari-downloader] an error occurred while fetching stylesheets. there are 3 different stylesheets. only supporting one. the layout may be different from the one online. sorry for that.
[safari-downloader] downloaded stylesheet files...
[safari-downloader] epub successfully saved. exiting...

Unhandled 'error' event

[safari-downloader] starting application...
[safari-downloader] the user "ccuty_07" was successfully authorized...
[safari-downloader] downloaded meta files...
[safari-downloader] downloaded table of content files...
[safari-downloader] downloaded chapter files...
[safari-downloader] downloaded stylesheet files...
events.js:163
throw er; // Unhandled 'error' event
^

Error: EISDIR: illegal operation on a directory, open '.'

Downloaded file not found

It said epub successfully saved.exiting...
but not able to find the downloaded file in the location I specified..

add --queue-list option

It would be great if the app had an option to list the books (titles, ids) from the queue, saving a trip to the website.

P.S: Thanks for making a very neat and useable tool!

Order of downloaded files

First of all thank you for putting the time and effort to make this tool and share it with the community.

One of the main issues I see is to be able to follow the chapters from the compressed file. Obviously we don’t have a way to sort the files e.g by download time as the time stamp will likely be all the same.

So I am thinking if you have had considered to make something for this,

Many thanks,
Kind regards,
Federico.

what i do wrong if i get response like below :

$ safaribooks-downloader -d -b 9781484224427 -u yyy -p xxx -o testbook.epub
[safari-downloader] starting application...
{ request:
{ debugId: 1,
uri: 'https://www.safaribooksonline.com/oauth2/access_token/',
method: 'POST',
headers:
{ host: 'www.safaribooksonline.com',
'content-type': 'application/x-www-form-urlencoded',
accept: 'application/json',
'content-length': 144 },
body:
'client_id=446a8a270214734f42a7&client_secret=f52b3e30b68c1820adb08609c799cb6da1c29975&grant_type=password&username=yyy&password=xxx' } }
{ response:
{ debugId: 1,
headers:
{ 'content-type': 'text/html',
location: 'https://www.oreilly.com/oauth2/access_token/',
'content-length': '0',
'accept-ranges': 'bytes',
date: 'Fri, 12 Apr 2019 10:02:08 GMT',
via: '1.1 varnish',
connection: 'close',
'x-client-ip': '159.255.187.94',
'x-served-by': 'cache-hhn1549-HHN',
'x-cache': 'MISS',
'x-cache-hits': '0',
'x-timer': 'S1555063328.898212,VS0,VE152' },
statusCode: 302,
body: undefined } }
[safari-downloader] StatusCodeError: 302 - undefined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.