From 623158bb01c02e3aa3fc6f8f0f03920277218343 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 31 Jan 2021 13:07:50 -0600 Subject: [PATCH] Enable pagecache for base_efiction. --- calibre-plugin/plugin-defaults.ini | 1 + fanficfare/adapters/base_efiction_adapter.py | 6 +++--- fanficfare/defaults.ini | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index c8affe7f..fd488a11 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -554,6 +554,7 @@ internalize_text_links:true use_pagecache:false [base_efiction] +use_pagecache:true ## At the time of writing, eFiction Base adapters allow downloading ## the whole story in bulk using the 'Print' feature. If 'bulk_load' diff --git a/fanficfare/adapters/base_efiction_adapter.py b/fanficfare/adapters/base_efiction_adapter.py index ea63eb2b..fb359b3a 100644 --- a/fanficfare/adapters/base_efiction_adapter.py +++ b/fanficfare/adapters/base_efiction_adapter.py @@ -207,7 +207,7 @@ class BaseEfictionAdapter(BaseSiteAdapter): or getMessageThereIsNoSuchAccount in html \ or getMessageWrongPassword in html - def _fetch_to_soup(self, url): + def _fetch_to_soup(self, url, usecache=False): """ Fetch a HTML document, fix it and parse it to BeautifulSoup. @@ -215,7 +215,7 @@ class BaseEfictionAdapter(BaseSiteAdapter): Makes image links absolute so they can be downloaded """ - html = self.get_request(url) + html = self.get_request(url,usecache=usecache) # Some site use old, old-school Comments (single dash) html = re.sub("", "", html) @@ -374,7 +374,7 @@ class BaseEfictionAdapter(BaseSiteAdapter): if self.getMessageRegisteredUsersOnly() in errorDiv.prettify(): if not self.triedLoggingIn: self.performLogin(self.url) - soup = self._fetch_to_soup(printUrl) + soup = self._fetch_to_soup(printUrl,usecache=False) errorDiv = soup.find("div", "errortext") self.triedLoggingIn = True else: diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index 30d3fefe..b6c16b15 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -581,6 +581,7 @@ internalize_text_links:true use_pagecache:false [base_efiction] +use_pagecache:true ## At the time of writing, eFiction Base adapters allow downloading ## the whole story in bulk using the 'Print' feature. If 'bulk_load'