GithubHelp home page GithubHelp logo

diwahars / packtpub-crawler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from niqdev/packtpub-crawler

0.0 1.0 0.0 41 KB

Download FREE eBook every day

HTML 45.24% JavaScript 1.47% Python 53.29%

packtpub-crawler's Introduction

packtpub-crawler

Download FREE eBook every day from www.packtpub.com

This crawler automates the following step:

  • grab the hidden form parameters
  • access to private account
  • claim the daily free eBook
  • parse title, description and useful information
  • download favorite format .pdf .epub .mobi
  • download source code and book cover
  • upload files to Google Drive

Default command

# upload pdf to drive
python script/spider.py -c config/prod.cfg -u drive

Other options

# download all format
python script/spider.py --config config/prod.cfg --all

# download only one format: pdf|epub|mobi
python script/spider.py --config config/prod.cfg --type pdf

# download also additional material: source code (if exists) and book cover
python script/spider.py --config config/prod.cfg -t pdf --extras
# equivalent (default is pdf)
python script/spider.py -c config/prod.cfg -e

# download and then upload to Drive (given the download url anyone can download it)
python script/spider.py -c config/prod.cfg -t epub --upload drive
python script/spider.py --config config/prod.cfg --all --extras --upload drive

Configuration

You need to create config/prod.cfg file with your Packt Publishing credential, look at config/prod_example.cfg for a sample.

From documentation, Drive API requires OAuth2.0 for authentication, so to upload files you should:

  • Go to APIs Console and make a new project named PacktpubDrive
  • On Services menu, turn Drive API on
  • On API Access menu, create OAuth client ID
    • Application type: Installed application
    • Installed application type: Other
  • Click Download JSON and save the file config/client_secrets.json.
  • Documentation: OAuth, Quickstart, example and permissions

Development (only for spidering)

Run a simple static server with

node dev/server.js

and test the crawler with

python script/spider.py --dev --config config/dev.cfg --all

Possible improvements

  • compress files before upload
  • add uploading service for Dropbox
  • notify via email
  • log to file and console: example
  • cron

packtpub-crawler's People

Contributors

niqdev avatar

Watchers

 avatar

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.