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

How to download Orielly books #88

Open
mylamour opened this issue Sep 24, 2021 · 0 comments
Open

How to download Orielly books #88

mylamour opened this issue Sep 24, 2021 · 0 comments
Labels
工具 tools 教程 tutorial

Comments

@mylamour
Copy link
Owner

mylamour commented Sep 24, 2021

I prefer to use E-book device but not orielly app or web. At the beginning i want to write a spider, but i found we already have a good tools. Also The book download is for personal use only and does not involve copyright issues.

Step 1 : Get Safaribooks tool

git clone https://github.com/lorenzodifuccia/safaribooks
cd safaribooks
python -m venv test
source test/bin/activate
pip install -r requirements.txt -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple

Step 2: Login into Orielly and get cookies

Login into Orielly and go to profile page https://learning.oreilly.com/home/

 javascript:(function(){var output={};document.cookie.split(/\s*;\s*/).forEach(function(pair){pair=pair.split(/\s*=\s*/);output[pair[0]]=pair.splice(1).join('=')});var a=window.document.createElement('a');a.href=window.URL.createObjectURL(new Blob([JSON.stringify(output)],{type:'text/json'}));a.download='cookies.json';document.body.appendChild(a);a.click();document.body.removeChild(a)})()

Step 3: Download it

cp ~/Downloads/cookies.json .
python safaribooks.py 9781492043447

image

Step 4 : Reading

image

Step 5: Convert to PDF

brew install basictex
pandoc infile.epub -o output.pdf
@mylamour mylamour added 工具 tools 教程 tutorial labels Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
工具 tools 教程 tutorial
Projects
None yet
Development

No branches or pull requests

1 participant