def fragmenttxt(self, response,number):
pages = Selector(response).xpath('//p/a/@name').extract()
text = Selector(response).xpath('//div[@class="texto_completo"]').extract()
result = []
control = False
try:
firstopage = Utils.getnumber(pages[0])
except:
firstopage= "1"
control = True
# selecciona del texto solo la pagina que nos resulta útil
splittext = text[0].split("<br><br>")
for i in splittext:
if Utils.checkPage(i,number):
control = True
continue
elif int(number) < int(firstopage):
control = True
if control and Utils.checkPage(i,str(int(number)+1)):
break
if control:
result.append(i)
return Utils.concatlist(result)
评论列表
文章目录