Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def summarize(self, force=False):
if force or not self.title:
try:
self.title, self.summary, image_url = sponge.summary(self.url)
except:
image_url = None
print "Failed extraction of ", self.url
if image_url and (force or not self.image):
self.image = sponge.image(image_url)
# try and make thumbnail
files.thumbnail(self.image)
def screenshot(url, force=False):
path = files.screenshot_path(url)
if not os.path.exists(path):
driver = webdriver.PhantomJS()
driver.set_window_size(1024, 768)
driver.get(url)
driver.save_screenshot(path)
files.square_crop(path)
files.thumbnail(path)
return path
#print "Screenshot saved to: ",filepath