def POST(self): del self.urllist[:] startURL = web.input().startURL if not startURL.endswith('/'): #格式化地址 startURL = startURL + '/' if startURL.find('browse') > 0: self.dbname = alldbname for i in range(100): self.urllist.append(startURL + str(i) + '/3/') elif startURL.find('top') > 0: self.dbname = alldbname if startURL.endswith('top/'): self.urllist = fetchtpb.get_topURL(startURL) else: self.urllist.append(startURL) else: return render.error('输入URL错误,只接受browse页面及top页面', None) print self.urllist, self.dbname for url in self.urllist: fetchtpb.fetch(url, self.dbname) return render.daemon('抓取完毕')
def GET(self): try: resource_info_id_str = web.ctx.path resource_info_id = int(resource_info_id_str.split("/")[2]) result = mirrordb.get_extern_info(resource_info_id) return render.resource_info(result[0]) except: return render.error("没有找到您要的信息,我们会尽快录入", "/")
def GET(self): try: resource_info_id_str = web.ctx.path resource_info_id = int(resource_info_id_str.split("/")[2]) results = mirrordb.get_resource_group(resource_info_id) return render.view(results, [], 0, 0, 0) except: return render.error("没有找到您要的信息,我们会尽快录入", "/")
def GET(self): comic_aka_name = web.input().comic_aka_name regurl = web.input().comicurl vol_no = web.input().vol capture_no = web.input().capture totalpages = web.input().totalpages vol_capture_name = web.input().volcapturename begin_page_no = web.input().beginpageno comic_id = -1 res = db.query('select * from ' + ComicResource + ' where aka_name="' + comic_aka_name + '"').list() try: comic_id = res[0]['comic_id'] except: #没有这部漫画,先插入 db.insert(ComicResource, aka_name= comic_aka_name, hotrank = 10) comic_id = db.query('select * from ' + ComicResource + ' where aka_name="' + comic_aka_name + '"').list()[0]['comic_id'] urllist = [] try: page_url_no_length = int(regurl[regurl.find('*') + 1]) except: return render.error('地址格式错误!', '/createcomicpage') for i in xrange(int(begin_page_no), int(totalpages) + int(begin_page_no)): strformat = "%0" + str(page_url_no_length) + "d" stri = strformat % (i,) stri = str(stri) striV2 = "%03d" %(i - int(begin_page_no) + 1) url = regurl[:regurl.find('*') - 1] + stri + regurl[regurl.find('*') + 3:] urlV2 = '' if int(vol_no) > 0: urlV2 = backregurl + comic_aka_name + '/vol_' + str(vol_no) + '/' + striV2 + regurl[regurl.find('*') + 3:].lower() elif int(capture_no) > 0: urlV2 = backregurl + comic_aka_name + '/capture_' + str(capture_no) + '/' + striV2 + regurl[regurl.find('*') + 3:].lower() urllist.append(url) try: db.insert(ComicURL.replace('V2', ''), vol = vol_no, capture = capture_no, page = i, url = url, comic_id = comic_id, quality_rank = 0, vol_capture_name = vol_capture_name) db.insert(ComicURL.replace('V2', '') + 'V2', vol = vol_no, capture = capture_no, page = i, url = urlV2, comic_id = comic_id, quality_rank = 0, vol_capture_name = vol_capture_name) except: return render.error('URL已经录入,重复!', '/createcomicpage') #搞定了,返回一个OK页面 return render.ok(urllist)
def GET(self): try: resource_info_id_str = web.ctx.path resource_info_id = int(resource_info_id_str.split('/')[2]) results = mirrordb.get_resource_group(resource_info_id) return render.view(results, [], 0, 0, 0) except: return render.error("没有找到您要的信息,我们会尽快录入", "/")
def GET(self): try: resource_info_id_str = web.ctx.path resource_info_id = int(resource_info_id_str.split('/')[2]) result = mirrordb.get_extern_info(resource_info_id) return render.resource_info(result[0]) except: return render.error("没有找到您要的信息,我们会尽快录入", "/")
def GET(self): callback = web.input().callback comic_id = web.input().id vols, min_capture, max_capture = mirrordb.get_comic_length(comic_id) try: aka_name = mirrordb.get_comic_aka_name_by_id(comic_id) except: return render.error("查询出错",'/') print callback + '(' + json.dumps({"aka_name":aka_name, "vols":vols, "min_capture":min_capture, "max_capture":max_capture}) + ')' return callback + '(' + json.dumps({"aka_name":aka_name, "vols":vols, "min_capture":min_capture, "max_capture":max_capture}) + ')'
def notfound(): return web.notfound(render.error("Hi,这个页面掉入了宇宙的漩涡,二次纪元后才会重新出现...", '/'))
def notfound(): return web.notfound(render.error("Hi,不要乱推门,乖...", "/"))