kajweb / wqxuetang_downloader

文泉学堂、悦读下载器 | 2020-02-16网站不再公益开放阅读,项目失效。
MIT License
219 stars 119 forks source link

打补丁后提示一个小问题 #30

Closed ssgemail closed 4 years ago

ssgemail commented 4 years ago

技术攻防战,精彩!

Traceback (most recent call last): File "main.py", line 12, in initUrllib(); File "C:\wqxuetang_downloader-master\utils.py", line 78, in initUrllib cookie = http.cookiejar.LWPCookieJar() NameError: name 'http' is not defined

kajweb commented 4 years ago

在utils上面增加 import http.cookiejar

ssgemail commented 4 years ago

加了之后,另一个异常

book = wqxtDownloader( bid );

File "C:\wqxuetang_downloader-master\wqxtDownloader.py", line 30, in init self.name = bookInfo['name']; TypeError: list indices must be integers or slices, not str

kajweb commented 4 years ago

这个你是的cookies有问题

kajweb commented 4 years ago

我的是26位英文、数字

ssgemail commented 4 years ago

001

kajweb commented 4 years ago

bid是否没问题

ssgemail commented 4 years ago

bid正确 https://lib-nuanxin.wqxuetang.com/#/Book/3208994

litengde commented 4 years ago

C:\Users\liten\Desktop\wqxuetang_downloader-master\cookies.txt 请输入需要下载的bid:2175744 Traceback (most recent call last): File "C:\Users\liten\Desktop\wqxuetang_downloader-master\main.py", line 23, in book = wqxtDownloader( bid ); File "C:\Users\liten\Desktop\wqxuetang_downloader-master\wqxtDownloader.py", line 30, in init self.name = bookInfo['name']; TypeError: list indices must be integers or slices, not str

我的报错这个

kajweb commented 4 years ago

你们登录成功没?需要先登录哇……

ssgemail commented 4 years ago

成功了,要不然无法获取PHPSESSID={vj30d4gnfqunk2lrbd9b6rc31s}

kajweb commented 4 years ago

https://lib-nuanxin.wqxuetang.com/v1/read/initread?bid=2175744 直接在浏览器打开,看看能不能获得数据

ssgemail commented 4 years ago

可以 {"data":{"canread":1,"upperlimit":1,"bid":"2175744","toshelf":null,"name":"计算机网络基础","title":"《计算机网络基础》 刘勇 邹广慧 【正版电子纸书阅读_PDF下载】- 书问","pages":"311","coverurl":"https://bookask-cover.oss-cn-beijing.aliyuncs.com/c/2/175/2175744/2175744.jpg!b","volume_list":[],"ismultivolumed":"0","lastpage":1,"last_volume":1,"price":"39.00","sellprice":"25.35","canreadpages":"311","uid":"1163643","textbook":"0","paperlowprice":"26.90","paperurl":"http://product.dangdang.com/24011520.html?_ddclickunion=P-327429|ad_type=10|sys_id=1#dd_refer="},"errcode":0,"errmsg":"success"}

litengde commented 4 years ago

{“ data”:{“ canread”:1,“ upperlimit”:1,“ bid”:“ 2175744”,“ toshelf”:null,“ name”:“计算机网络基础”,“ title”:“《计算机网络》基础》刘勇邹广慧【正版电子纸书阅读_PDF下载】-书问“,”页面“:” 311“,” coverurl“:” https://bookask-cover.oss-cn-beijing.aliyuncs.com /c/2/175/2175744/2175744.jpg!b","volume_list":[],"multivolumed":"0","lastpage":"10","last_volume":"1","price“ :“ 39.00”,“卖价”:“ 25.35”,“ canreadpages”:“ 311”,“ uid”:“ 1143990”,“教科书”:“ 0”,“ paperlowprice”:“ 26.90”,“ paperurl”:“ http://product.dangdang.com/24011520。html?_ddclickunion = P-327429 | ad_type = 10 | sys_id = 1#dd_refer =“},” errcode“:0,” errmsg“:”成功“}

litengde commented 4 years ago

应该就是不会打补丁。。。我也是

kajweb commented 4 years ago

格式是这样的 Set-Cookie3: PHPSESSID=XXXXXXXXXXXXXXXXXX; path="/"; domain=.wqxuetang.com; path_spec; expires="0"; version=0

kajweb commented 4 years ago

把你的main.py的代码发上来

litengde commented 4 years ago

!/usr/bin/python3

-- coding: UTF-8 --

from utils import from wqxtDownloader import ;

初始化全局变量

globalvar_init();

初始化urllib

setCookiesFile(os.getcwd()+"\cookies.txt"); initUrllib();

删除initUrllibNoCookies();

初始化logging

if name == 'main':

usage: python3 main.py

loggingLevel("INFO");
LSArg = len(sys.argv);
if LSArg==1:
    bid = input("请输入需要下载的bid:");
    book = wqxtDownloader( bid );
    book.start();
else:
    bid = sys.argv[1];
    book = wqxtDownloader( bid );
    book.start( *(int(x) for x in sys.argv[2:]) );
ssgemail commented 4 years ago

哦,找到原因了 PHPSESSID={vj30d4gnfqunk2lrbd9b6rc31s} 需要变为 PHPSESSID=vj30d4gnfqunk2lrbd9b6rc31s

ssgemail commented 4 years ago

感谢kajweb

litengde commented 4 years ago

我的也好了

Kuoliang-Chung commented 4 years ago

谢谢大佬kajweb