From 11151033f6f579074d333fc4bc2cd881c5fa7957 Mon Sep 17 00:00:00 2001 From: spicybiguy Date: Fri, 28 Nov 2025 04:53:16 -0500 Subject: [PATCH] [motherless] fix 'gallery_title' extraction (#8605) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update motherless.py for title selector Updated the selector for the title property for Motherless galleries to be an h2 instead of an h1 to reflect changes on the site * fix 'gallery_title' extraction --------- Co-authored-by: Mike Fährmann --- gallery_dl/extractor/motherless.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gallery_dl/extractor/motherless.py b/gallery_dl/extractor/motherless.py index e26e3061..1419abf0 100644 --- a/gallery_dl/extractor/motherless.py +++ b/gallery_dl/extractor/motherless.py @@ -41,6 +41,8 @@ class MotherlessExtractor(Extractor): path, _, media_id = path.rpartition("/") data = { "id" : media_id, + "title": text.unescape( + (t := extr("", "<")) and t[:t.rfind(" | ")]), "type" : extr("__mediatype = '", "'"), "group": extr("__group = '", "'"), "url" : extr("__fileurl = '", "'"), @@ -49,7 +51,6 @@ class MotherlessExtractor(Extractor): for tag in text.extract_iter( extr('class="media-meta-tags">', "</div>"), ">#", "<") ], - "title": text.unescape(extr("<h1>", "<")), "views": text.parse_int(extr( 'class="count">', " ").replace(",", "")), "favorites": text.parse_int(extr( @@ -131,10 +132,9 @@ class MotherlessExtractor(Extractor): if title: return text.unescape(title.strip()) - pos = page.find(f' href="/G{gallery_id}"') - if pos >= 0: - return text.unescape(text.extract( - page, ' title="', '"', pos)[0]) + if f' href="/G{gallery_id}"' in page: + return text.unescape( + (t := text.extr(page, "<title>", "<")) and t[:t.rfind(" | ")]) return ""