From 4fdef7b837ca8dc4c3840062eee5829e08242bd7 Mon Sep 17 00:00:00 2001
From: David Izquierdo <david@izquierdofernandez.com>
Date: Tue, 11 Jul 2023 05:26:50 +0200
Subject: [PATCH] Add scrape and rewrite rules for webtoons

Although the only source I have for the rewrite rule is, in fact, https://github.com/miniflux/v2/pull/892, it does work when combined with add_dynamic_image and scraping the right element. I have not investigated further.

Works around https://github.com/miniflux/v2/issues/775 and https://github.com/miniflux/v2/issues/1871 (as in, gives us working webtoons feeds but referer spoofing would still be a nice tool to have).

Fixes https://github.com/miniflux/v2/issues/256.
---
 reader/rewrite/rules.go | 1 +
 reader/scraper/rules.go | 1 +
 2 files changed, 2 insertions(+)

diff --git a/reader/rewrite/rules.go b/reader/rewrite/rules.go
index c2262644..8d98dc5b 100644
--- a/reader/rewrite/rules.go
+++ b/reader/rewrite/rules.go
@@ -32,6 +32,7 @@ var predefinedRules = map[string]string{
 	"thedoghousediaries.com": "add_image_title",
 	"theverge.com":           `add_dynamic_image, remove("div.duet--recirculation--related-list")`,
 	"treelobsters.com":       "add_image_title",
+	"webtoons.com":           `add_dynamic_image,replace("webtoon"|"swebtoon")`,
 	"www.qwantz.com":         "add_image_title,add_mailto_subject",
 	"www.recalbox.com":       "parse_markdown",
 	"xkcd.com":               "add_image_title",
diff --git a/reader/scraper/rules.go b/reader/scraper/rules.go
index 8e0fef74..6dcda370 100644
--- a/reader/scraper/rules.go
+++ b/reader/scraper/rules.go
@@ -50,6 +50,7 @@ var predefinedRules = map[string]string{
 	"universfreebox.com":   "#corps_corps",
 	"version2.dk":          "section.body",
 	"wdwnt.com":            "div.entry-content",
+	"webtoons.com":         ".viewer_img",
 	"wired.com":            "main figure, article",
 	"zeit.de":              ".summary, .article-body",
 	"zdnet.com":            "div.storyBody",
-- 
GitLab