Open learning-123 opened 5 years ago
Hey, after -b should write file type that you want to download, i.e. pdf, epub etc. I don't know why you get this the error. I'll check if packtpub changed anything in his api and maybe next week I'll fix.
so if I need a file called excel.pdf, I should write excel.pdf at the end or just pdf in general.
hi, it's not working, i guess something changed in the API as you say.
@learning-123 You should be able to just use "pdf" after the -b option.
@0xKiewicz What options are you using (please make sure to exclude your username and password)? I haven't found any problems downloading, so there may be a bug here.
Hi @BurnhamG , I'm using:
python3 main.py -e xxxx.xxxx@gmail.com -p xxxxxxxxxx -d ~/Desktop/packt -b pdf -v
Book is already in "saved titles", and i get this error:
You are in! Traceback (most recent call last): File "main.py", line 226, in
main(sys.argv[1:]) File "main.py", line 198, in main books = get_books(user, is_verbose=verbose, is_quiet=quiet) File "main.py", line 41, in get_books print(f'You have {str(r.json()["count"])} books') KeyError: 'count'
Thanks, @0xKiewicz! It seems like there's some problem or change in the response from the server. I'd say you should try editing the main.py file, and inserting this above line 41 in the file:
print(str(r.json())
Then run the same command, copy what that returns for you, and paste it here. Thanks again, I hope we can get this resolved for you.
You are in! {'message': 'User ID d343422-05bd-40b9-n76f-nh4gdhh42 does not own product', 'errorCode': 4000031, 'errorId': 'aa4f1997-5a60-4622-b606-21bdfaaca2da'} Getting list of books... Traceback (most recent call last): File "main.py", line 226, in
main(sys.argv[1:]) File "main.py", line 198, in main books = get_books(user, is_verbose=verbose, is_quiet=quiet) File "main.py", line 45, in get_books pages_list = trange(r.json()['count'] // limit, unit='Pages') KeyError: 'count'
@0xKiewicz That's an odd error, and unfortunately there's not much there to tell us why the API returns that error. The only thing I can think of that might cause that error is logging in with an account that doesn't have any purchased or claimed products, but if your account does have claimed products then I'm not sure what the problem is. I haven't been able to replicate it on my end either, unfortunately.
Hi @0xKiewicz and @learning-123, I haven't given up on trying to have the program handle this. Thank you both for your patience.
Here's the info from this comment:
Below are links to a version that is this repo's master branch with slight changes to address these problems, as well as a version that includes parallel downloading (from PR #18).
Current master with patch: https://github.com/BurnhamG/packtpub-downloader/tree/error_fix
Patch with parallel downloads: https://github.com/BurnhamG/packtpub-downloader/tree/async
Let me know whether these seem to help, or if you're still seeing the same error.
I get the following error. Traceback (most recent call last): File "main.py", line 227, in
main(sys.argv[1:])
File "main.py", line 199, in main
books = get_books(user, is_verbose=verbose, is_quiet=quiet)
File "main.py", line 41, in get_books
print(f'You have {str(r.json()["count"])} books')
KeyError: 'count'
Can anyone please tell me how exactly it should be done. i.e.
python main.py -e email -p password -d ~/Desktop/packt -b pdf
What should be after -b, is it file name or just pdf.