kindle manager

This commit is contained in:
gavin
2020-06-18 14:00:42 +08:00
parent dff52d3f48
commit a22934d61d
11 changed files with 32 additions and 7 deletions

View File

@@ -86,7 +86,7 @@ testbooks=['24堂财富课',
class bookInfoSpide():
[re_bn,re_bn,re_score,re_star,re_author,re_end]=[None,None,None,None,None,None]
[re_bn,re_bn,re_score,re_star,re_author,re_description,re_end]=[None,None,None,None,None,None,None]
if ISDOUBAN==1:
re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\".+?rating_nums\">(.+?)<''', re.S)
re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\"''')
@@ -94,6 +94,7 @@ class bookInfoSpide():
re_score=re.compile(r'''class=\"rating_nums\">(.+?)<''')
re_ratenum=re.compile(r'''^<span>\((\d+)人评价\)</span>''')
re_author=re.compile(r'''class=\"subject-cast\">(.+?)<''')
re_description=re.compile(r'''^<p>(.+?)(<\/p>){0,1}$''')
else:
re_asin=re.compile(r'''^<div data-asin=\"(.+?)\" data-index''')
re_img=re.compile(r'''^<img src=\"(.+?)\"$''')
@@ -195,7 +196,14 @@ class bookInfoSpide():
bkinfo[sid]['author']='/'.join(author)
else:
bkinfo[sid]['author']=ret[0]
stat='DESCRIPTION'
continue
elif stat=='DESCRIPTION':
ret=re.search(self.re_description, line)
if ret:
bkinfo[sid]['description']=ret.group(1)
stat='SID'
continue
else: continue
else:
stat='ASIN'
@@ -277,7 +285,7 @@ class bookInfoSpide():
mbkn=mbkinfo[0]
for k,v in mbkinfo[1].items():
bkn=v['bookname']
if len(v)==8:
if len(v)==9:
if (not f1) and (mbkn in bkn):
f1=1
d1={mbkn:v}