Code Monkey home page Code Monkey logo

packtpubbot's Introduction

packtpubbot

A bot for claim daily free learning ebooks from packtpub. It also notify you over Pushbullet or Telegram. It can download the ebook after claim if you want. It's designed as cron job task on a Raspberry Pi.

Requirements

  • node.js, version 6.0.0+ (only tested on v6)

How to install

git clone https://github.com/mtuanp/packtpubbot.git

Configuration

The bot uses a json configuration file for providing login credentials. Add file names config.json in your working directory where you cloned. Example of config.json:

{
  "informBy": "",
  "downloadAfterClaim": true,
  "outputDirectory": null,
  "packtpub": {
    "email": "put your email here",
    "password": "put your password here"
  },
  "pushbullet": {
    "apiKey": "put your pushbullet api key here"
  },
    "telegram": {
    "botToken" : "put your telegram bot token here",
    "receiverId" : "put destination user id here"
  }
}

informBy

Configure the desired notification platform, if leaves it blank will be output to console. Aceptable values:

  • telegram
  • pushbullet

downloadAfterClaim

Configure to download the ebook after claim. Default value: true Aceptable values:

  • true
  • false

outputDirectory

Configure the desired directory to output the ebook. The ebook will be download at the same directory as the index.js if leaves this null Default value: null

outputFormat

Configure the desired format to download the ebook. Default value: pdf Aceptable values:

  • pdf
  • epub
  • mobi

By seprating with ';', multiple file-formats can be downloaded. Example for downloading pdf and epub:

  • pdf;epub

packtpub

email

email to login into https://www.packtpub.com

password

password to login into https://www.packtpub.com

pushbullet

apiKey

apiKey provided by https://www.pushbullet.com

telegram

botToken

the bot token provided by botFather

receiverId

the telegram user id to receive the notification

How to use

After set up your config.json, you start the bot with following statements:

npm install # only on first run
npm start

Cron job

Find the absolute location of npm and copy it:

which node

Open cron job table with:

crontab -e

Add following statements for every day cron job at 9 am:

0 9 * * * <PATH_TO_NODE>/node <PATH_TO_REPO>/index.js >> /var/log/packtpub.log 2>&1

packtpubbot's People

Contributors

maikemota avatar mtuanp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

packtpubbot's Issues

Uninstall method?

I looked for a bot what claim and allows me download the e-books and I found this project. I read this and I consider it very interesting but my question is if in whatever moment I want to remove to my raspberry pi, does exist an easy method to uninstall or not? and I would have to remove everything step by step.
And in that case how do I could to remove then?

I am doing Something wrong but I don't know what

Hello this is my packtpub.log
const config = require('./config.json');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

And this is my config.json in my packtpub folder user and password I have put right but here I put so with '*':

{
/* Choose 'telegram' or 'pushbullet' according to your favorite way of get informed /
"informBy": "",
/
Determines if you want do download the ebook after claim*/
"downloadAfterClaim": false,
/*
Determines where you want do download the ebook after claim
If this config is null, the file will be download at same directory as index.js
/
"outputDirectory": null,
"dowloadFormat": "pdf",
"packtpub": {
"email": "phillipm
****@.com",
"password": "
"
},
"pushbullet": {
"apiKey": ""
},
/* to use telegram, you have to create a bot first. See: https://core.telegram.org/bots#3-how-do-i-create-a-bot */
"telegram": {
"botToken" : "",
"receiverId" : ""
}
}

reCAPTCHA

Since today morning, the packtpub is requesting to answer to reCAPTCHA to claim the free ebook.

Now we have to figure out how to bypass the verification or the bot only will be able to download the ebook after user claim manually

Anyone has any suggestion or solution for this?

image

How could I do it?

hello, I want to download the same ebook in 2 different formats (pdf and mobi).
How could I do it?
I've tried to change the config.json so:

{
"informBy": "",
"downloadAfterClaim": true,
"outputDirectory": ".../packtpub/",
"dowloadFormat": "pdf",
"packtpub": {
"email": "phillip******@******* . com",
"password": "******"
},
"pushbullet": {
"apiKey": "put your pushbullet api key here"
},
"telegram": {
"botToken" : "put your telegram bot token here",
"receiverId" : "put destination user id here"
}
}

In bold above I added: "pdf", "mobi",
"pdf mobi",
"mobi",
pdf mobi,

Even I copied 2 times the entire config.json at the same file but it doesn't work.
How Could i do it?
thanks

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.