From cf28bc26f07ceec727cbd91f3de0c33dbfd8822a Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 10 Mar 2024 16:14:14 -0500 Subject: [PATCH] adapter_deviantartcom: Add another way to remove comments section. --- fanficfare/adapters/adapter_deviantartcom.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fanficfare/adapters/adapter_deviantartcom.py b/fanficfare/adapters/adapter_deviantartcom.py index 8d30a288..c46398dc 100644 --- a/fanficfare/adapters/adapter_deviantartcom.py +++ b/fanficfare/adapters/adapter_deviantartcom.py @@ -226,6 +226,12 @@ class DeviantArtComSiteAdapter(BaseSiteAdapter): comments = soup.select_one('[data-hook=comments_thread]') if comments: comments.decompose() + # previous search not always found in some stories. + #
inside the real containing + # div seems more common + commentsdiv = soup.select_one('div#comments') + if commentsdiv: + commentsdiv.parent.decompose() content = soup.select_one('[data-id=rich-content-viewer]') if content is None: