之前我也发过两次 PACKT 的免费领取限免技术书籍的帖子,有时候有需要的书却因为一些事情忘记去领取而错过,所以就有了这个小工具,现在挂在服务器上自动领取,不需要理会了。
用了 Requests
和 PyQuery
这两个库
个人需求的产物,写得比较随意,需要的自取~
安装依赖
sudo pip install -r requirements.txt
最后运行
python main.py
运行选项
eBooks
文件夹中config.py
中修改 frequency
的值只支持 Python3
.
1
xiaozizayang 2017-05-12 21:22:15 +08:00
老哥稳
|
2
ruter8 OP @xiaozizayang 别,你写的都是好东西,我这个无关痛痒的
|
3
xiaozizayang 2017-05-12 21:43:10 +08:00
@ruter8 来合作搞个电子书的
|
4
davidyin 2017-05-13 01:48:19 +08:00
我刚才试用了一下,出现下面的提示信息,对 python 不懂。
Practical Linux Security Cookb has been saved! Trying next... Traceback (most recent call last): File "main.py", line 165, in <module> options[step]() File "main.py", line 120, in save_ebooks save_dir = get_save_path(name) File "main.py", line 34, in get_save_path save_path = os.path.join(SAVE_DIR, name) File "/usr/lib/python3.5/posixpath.py", line 89, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types (funcname, s.__class__.__name__)) from None |
6
davidyin 2017-05-14 13:55:00 +08:00
昨天只有一本的是这样的,刚刚重新试了一下,多了两本,再次下载还是有错误信息。
yin@instance-2:~/free-PACKT-eBooks-Crawler$ python3 main.py Trying to load cookies... Choose an option: 1. Claim today's free ebook 2. Download all your ebooks 3. Auto claim free ebooks 0. Quit Your choice: 2 Start download your eBooks... Unity 5.x Shaders and Effects Cookb has been saved! Trying next... Learning AWS has been saved! Trying next... Practical Linux Security Cookb already existed! Traceback (most recent call last): File "main.py", line 165, in <module> options[step]() File "main.py", line 120, in save_ebooks save_dir = get_save_path(name) File "main.py", line 34, in get_save_path save_path = os.path.join(SAVE_DIR, name) File "/usr/lib/python3.5/posixpath.py", line 89, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types (funcname, s.__class__.__name__)) from None TypeError: join() argument must be str or bytes, not 'NoneType' |
7
davidyin 2017-05-14 13:55:30 +08:00
当然图书下载下来还是正常的。
|