packt-cli / Packt-Publishing-Free-Learning

Scripts that automatically claim and download free daily eBooks from https://www.packtpub.com/packt/offers/free-learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Script now failing to fetch JWT token or download, change to website?

eharris opened this issue · comments

Starting Nov 18, for packt-cli -gd the script has started producing:

[ERROR] - Fetching JWT token failed!
[INFO] - Start grabbing ebook...
[ERROR] - Exception occurred 'NoneType' object is not iterable

Nothing has changed with login credentials or any other config, and it was working fine prior to 11/18. Using version 1.4.3.

The script no longer works for me either. It seems that they require ReCaptcha solution for login request now (not only for Free Learning claim request), they've also rewritten their website to be rendered by AngularJS (but I'm not sure when they did this, it may have happened when they introduced API).

I'll try try to fix this (i cannot promise any deadline, it may be today, end of week or two weeks), you can try to do it independently if you want - you may be faster.

Thanks for submitting the issue, I haven't configured e-mails, so currently I don't get notifications about script errors.


Also, I'm 99% sure that parsing the website instead of using their API won't help (the ReCaptcha still won't allow you to pass by), besides that the code will be more complicated and ugly if we decide to parse their website. Also we'd need to use some parser that would run JavaScript, but I think that Beautiful Soup would deal with it with no problems.

It seems that I've got a solution. Try installing script with pip install git+https://github.com/luk6xff/Packt-Publishing-Free-Learning.git@recaptcha-on-login, see if that works.

I'll have to clean up this code further (than I'll make a pull request), I currently solve ReCaptcha twice - I think we can do this only once.

Hi everyone!
I have the same problem that you have - I cannot download any content from packthub.

Now I made in my copy of this script all change that mjenczyk made (in 3 files: src/api.py, src/claimer.py and arc/packtPublishingFreeEbook.py). This still not works for me :(

All right, but have you installed the script with the command I provided? If not can you describe what have you done and from where to where have you copied the files (and what are you trying to achieve)?

I can confirm installing the script with pip install git+https://github.com/luk6xff/Packt-Publishing-Free-Learning.git@recaptcha-on-login works.

commented

Please help

Screen Shot 2019-11-20 at 14 13 27

@jackyhjj You're using Python 2.7, the script doesn't support anything less than Python 3.5.

I'm still not convinced that it works, and I've got a single shot a day (ReCaptcha solution seems to be mandatory iff user tries to claim a book he doesn't already have) - today I got 400 response when claiming book.

{'message': 'The recaptcha solution is missing.', 'errorCode': 3000043, 'errorId': '85cbbf1e-e636-4cfb-afee-a057dc138395'}

I'll update the code afternoon, but I won't merge it before tomorrow.

For now - it is working for me!

What have I done?

  1. I have made a new copy of this packt script.
  2. I use "github desktop" program to download the latest branch of this script.
  3. Install it from "setup.py" file, restart my PC and... it works!!
commented

Is there anyway to download the ebook based on the bookID ? if yes, what parameter should I use ?

On a raspberry pi , rasbian, I have made a new virtual env python and downloaded this version. It works perfectly.

@ mjenczmyk : thanks a lot !!!!

I've merged, let me know if something will be wrong. Today I'll release a 1.5.0 version.

Do we need a recaptcha token to fetch books?

Yes, you need it since the beginning of the year. Since this week you need it to log into Packt account.

Isn't there any way to do this recaptcha manually? I just want to download the books.

@fref See #172 for a request for a way to solve recaptcha manually.

commented

@mjenczmyk saw your commit 6 hours ago, and in the config file there is a 'key' field. What to be filled in the key field ?

I got this error

Screen Shot 2019-11-22 at 09 42 51

It's the Anti Captcha API key, you'd need to register there to obtain one.

Is there a way to get less than $10 of credits on the Anti Captcha site other than the probably too few demo credits? Answered my own question, there is some odd process using a coupon code purchased from another Russian site.