def __Parse_image(self, content): images = htmllib.Parse_images_url(content) if images: try: for image in images: tmpimage = Media.all().filter("oldurl = ", image).get() if tmpimage != None: content = gbtools.stringQ2B(content) content = htmllib.decoding(content).replace(image, tmpimage.PhotoUrl()) except Exception, data: logging.info(data)
def __Parse_image(self, content): images = htmllib.Parse_images_url(content) if images: try: for image in images: tmpimage = Media.all().filter('oldurl = ', image).get() if tmpimage != None: content = gbtools.stringQ2B(content) content = htmllib.decoding(content).replace( image, tmpimage.PhotoUrl()) except Exception, data: logging.info(data)
def __Parse_image(self, entry): images = htmllib.Parse_images_url(entry.content) content = '' if images: try: for image in images: tmpimage = Media.all().filter('oldurl = ', image).get() if tmpimage != None: content = gbtools.stringQ2B(content) content = htmllib.decoding(entry.content).replace(image, tmpimage.PhotoUrl()) else: pass except Exception, data: return None return content
def __Parse_image(self, entry): images = htmllib.Parse_images_url(entry.content) content = '' if images: try: for image in images: tmpimage = Media.all().filter('oldurl = ', image).get() if tmpimage != None: content = gbtools.stringQ2B(content) content = htmllib.decoding(entry.content).replace( image, tmpimage.PhotoUrl()) else: pass except Exception, data: return None return content
def post(self): url = self.param('url') start_target = self.param('start_target') if not start_target: start_target = 'nohtml' allow_target = self.param('allow_target') if not allow_target: allow_target = 'nohtml' mid_target = self.param('mid_target') if not mid_target: mid_target = 'nohtml' end_target = self.param('end_target') if not end_target: end_target = 'nohtml' stop_target = self.param('stop_target') if stop_target: stop_target = htmllib.decoding(stop_target) else: stop_target = 'nohtml' result = self.dotest(url, start_target, mid_target, end_target, allow_target, stop_target) if result == False: self.write ('there is something wrong,please try again')
def post(self): url = self.param('url') start_target = self.param('start_target') if not start_target: start_target = 'nohtml' allow_target = self.param('allow_target') if not allow_target: allow_target = 'nohtml' mid_target = self.param('mid_target') if not mid_target: mid_target = 'nohtml' end_target = self.param('end_target') if not end_target: end_target = 'nohtml' stop_target = self.param('stop_target') if stop_target: stop_target = htmllib.decoding(stop_target) else: stop_target = 'nohtml' result = self.dotest(url, start_target, mid_target, end_target, allow_target, stop_target) if result == False: self.write('there is something wrong,please try again')