From cd1db0a462bee0fa66a1e4b02475cf9c4e4f9bc9 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Fri, 4 Oct 2024 20:16:38 -0500 Subject: [PATCH] adapter_deviantartcom: Site changes, new chapter text tag. See #1118 --- fanficfare/adapters/adapter_deviantartcom.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/fanficfare/adapters/adapter_deviantartcom.py b/fanficfare/adapters/adapter_deviantartcom.py index 9ead8827..5b9e533c 100644 --- a/fanficfare/adapters/adapter_deviantartcom.py +++ b/fanficfare/adapters/adapter_deviantartcom.py @@ -236,13 +236,21 @@ class DeviantArtComSiteAdapter(BaseSiteAdapter): if commentsdiv: commentsdiv.parent.decompose() - content = soup.select_one('[data-id=rich-content-viewer]') + # three different 'content' tags to look for. + # This is the current in Oct 2024 + content = soup.select_one('[data-editor-viewer="1"]') + if content is None: - # older story + # older story? I can't find any of this style in Oct2024 + content = soup.select_one('[data-id="rich-content-viewer"]') + + if content is None: + # olderer story, but used by some older (2018) posts content = soup.select_one('.legacy-journal') - if content is None: - raise exceptions.FailedToDownload( - 'Could not find story text. Please open a bug with the URL %s' % self.url + + if content is None: + raise exceptions.FailedToDownload( + 'Could not find story text. Please open a bug with the URL %s' % self.url ) return self.utf8FromSoup(url, content)