diff options
| author | 2024-10-13 15:28:45 +0200 | |
|---|---|---|
| committer | 2024-10-13 15:28:45 +0200 | |
| commit | ccb132523a4ee740d5b576574e9f44668021fbe6 (patch) | |
| tree | 0b6977a345c56eff277abb0bc9199b0010f003a8 /app/Services | |
| parent | 91624037c7d73eb545478aab2f8abc55fc224453 (diff) | |
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
Diffstat (limited to 'app/Services')
| -rw-r--r-- | app/Services/ExportService.php | 1 | ||||
| -rw-r--r-- | app/Services/ImportService.php | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/Services/ExportService.php b/app/Services/ExportService.php index 37bcdc6e3..c532308d7 100644 --- a/app/Services/ExportService.php +++ b/app/Services/ExportService.php @@ -23,6 +23,7 @@ class FreshRSS_Export_Service { final public const TYPE_JSON_DOTPATH = 'JSON+DotPath'; // Legacy 1.24.0-dev final public const TYPE_JSON_DOTNOTATION = 'JSON+DotNotation'; final public const TYPE_JSONFEED = 'JSONFeed'; + final public const TYPE_HTML_XPATH_JSON_DOTNOTATION = 'HTML+XPath+JSON+DotNotation'; /** * Initialize the service for the given user. 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'])) { |
