You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
def getBookName(text):
|
|
|
|
|
stpos = text.find('<div class="book-info ">')
|
|
|
|
|
return text[text.find('<em>',stpos)+4:text.find('</em>',stpos)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getAuthor(text):
|
|
|
|
|
indexTo = text.find('</a> 著')
|
|
|
|
|
indexFrom = indexTo-1
|
|
|
|
|
while text[indexFrom-1]!='>':
|
|
|
|
|
indexFrom = indexFrom - 1
|
|
|
|
|
return text[indexFrom:indexTo]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getImage(text):
|
|
|
|
|
indexFrom = text.find('//bookcover.yuewen.com/qdbimg/')
|
|
|
|
|
indexTo = text.find('
',indexFrom)
|
|
|
|
|
return 'https:'+text[indexFrom:indexTo]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getText(text):
|
|
|
|
|
div = text.find('<div class="book-intro">') + 24
|
|
|
|
|
indexFrom = text.find('<p>',div)+3
|
|
|
|
|
indexTo = text.find('</p>',div)
|
|
|
|
|
Message = ''
|
|
|
|
|
idx = indexFrom
|
|
|
|
|
while idx < indexTo:
|
|
|
|
|
if text[idx] == ' ' or text[idx] == ' ':
|
|
|
|
|
idx += 1
|
|
|
|
|
elif text[idx:idx+5] == ' ':
|
|
|
|
|
idx += 5
|
|
|
|
|
elif text[idx:idx+5] == '<br/>':
|
|
|
|
|
Message += '\n'
|
|
|
|
|
idx += 5
|
|
|
|
|
else:
|
|
|
|
|
Message += text[idx]
|
|
|
|
|
idx += 1
|
|
|
|
|
|
|
|
|
|
return Message
|