From ccb132523a4ee740d5b576574e9f44668021fbe6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 13 Oct 2024 15:28:45 +0200 Subject: New feed mode: HTML + XPath + JSON dot notation (JSON in HTML) (#6888) * New feed mode: HTML + XPath + JSON dot notation (JSON in HTML) Same as `JSON+DotNotation` but first extracting the JSON string from an HTML document thanks to an XPath expression. Example: `//script[@type='application/json']` fix https://github.com/FreshRSS/FreshRSS/discussions/6876 * JavaScript UI to show/hide new field * Casing xPathToJson * Slight renaming --- app/Services/ImportService.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/Services/ImportService.php') diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 1871c37e0..298c0ec21 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -168,6 +168,9 @@ class FreshRSS_Import_Service { case strtolower(FreshRSS_Export_Service::TYPE_JSONFEED): $feed->_kind(FreshRSS_Feed::KIND_JSONFEED); break; + case strtolower(FreshRSS_Export_Service::TYPE_HTML_XPATH_JSON_DOTNOTATION): + $feed->_kind(FreshRSS_Feed::KIND_HTML_XPATH_JSON_DOTNOTATION); + break; default: $feed->_kind(FreshRSS_Feed::KIND_RSS); break; @@ -257,6 +260,7 @@ class FreshRSS_Import_Service { if (!empty($jsonSettings)) { $feed->_attribute('json_dotnotation', $jsonSettings); } + $feed->_attribute('xPathToJson', $feed_elt['frss:xPathToJson'] ?? null); $curl_params = []; if (isset($feed_elt['frss:CURLOPT_COOKIE'])) { -- cgit v1.2.3