Skip to content

Commit 33fd07f

Browse files
committed
Conditional retrieval
fix #6149
1 parent 88eef98 commit 33fd07f

File tree

28 files changed

+110
-26
lines changed

28 files changed

+110
-26
lines changed

app/Controllers/subscriptionController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public function feedAction(): void {
299299
}
300300
}
301301

302+
$feed->_attribute('path_entries_condition', Minz_Request::paramTextToArray('path_entries_condition', plaintext: true));
302303
$feed->_attribute('path_entries_filter', Minz_Request::paramString('path_entries_filter', true));
303304

304305
$values = [

app/Models/Entry.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,22 @@ public function getContentByParsing(string $url = '', int $maxRedirs = 3): strin
814814
if ($url === '' || $feed === null || $feed->pathEntries() === '') {
815815
return '';
816816
}
817+
if (!empty($feed->attributeArray('path_entries_condition'))) {
818+
$found = false;
819+
foreach ($feed->attributeArray('path_entries_condition') as $condition) {
820+
if (trim($condition) === '') {
821+
continue;
822+
}
823+
$booleanSearch = new FreshRSS_BooleanSearch($condition);
824+
if ($this->matches($booleanSearch)) {
825+
$found = true;
826+
break;
827+
}
828+
}
829+
if (!$found) {
830+
return '';
831+
}
832+
}
817833

818834
$cachePath = $feed->cacheFilename($url . '#' . $feed->pathEntries());
819835
$html = httpGet($url, $cachePath, 'html', $feed->attributes(), $feed->curlOptions());

app/i18n/cs/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Přidat před existující obsah',
5858
'replace' => 'Nahradit existující obsah',
5959
),
60+
'content_retrieval' => 'Content retrieval', // TODO
6061
'css_cookie' => 'Použít cookies při načítání obsahu článku',
6162
'css_cookie_help' => 'Příklad: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>',
6263
'css_help' => 'Načte oříznuté kanály RSS (pozor, náročnější na čas!)',
6364
'css_path' => 'Přepínač CSS článku na původních webových stránkách',
6465
'css_path_filter' => array(
6566
'_' => 'selektor CSS prvků, které mají být odstraněny',
66-
'help' => 'Selektor CSS může být seznam, například: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>',
67+
'help' => 'Selektor CSS může být seznam, například: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>',
6768
),
6869
'description' => 'Popis',
6970
'empty' => 'Tento kanál je prázdný. Ověřte prosím, zda je stále udržován.',
@@ -201,6 +202,7 @@
201202
'no_selected' => 'Nejsou vybrány žádné kanály.',
202203
'number_entries' => '%d článků',
203204
'open_feed' => 'Open feed %s', // TODO
205+
'path_entries_condition' => 'Condition for content retrieval', // TODO
204206
'priority' => array(
205207
'_' => 'Viditelnost',
206208
'archived' => 'Nezobrazovat (archivováno)',

app/i18n/de/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Artikelinhalt vor Feed-Inhalt hinzufügen',
5858
'replace' => 'Artikelinhalt ersetzt Feed-Inhalt (Standard)',
5959
),
60+
'content_retrieval' => 'Content retrieval', // TODO
6061
'css_cookie' => 'Verwende Cookies beim Herunterladen des Feed-Inhalts mit CSS-Filtern',
6162
'css_cookie_help' => 'Beispiel: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>',
6263
'css_help' => 'Ruft bei gekürzten RSS-Feeds den vollständigen Artikelinhalt ab (Achtung, benötigt mehr Zeit!)',
6364
'css_path' => 'CSS-Selektor des Artikelinhaltes auf der Original-Webseite',
6465
'css_path_filter' => array(
6566
'_' => 'CSS-Selector für die Elemente, die entfernt werden sollen',
66-
'help' => 'CSS-Selector könnte eine Liste sein, wie z.B.: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>',
67+
'help' => 'CSS-Selector könnte eine Liste sein, wie z.B.: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>',
6768
),
6869
'description' => 'Beschreibung',
6970
'empty' => 'Dieser Feed ist leer. Bitte stellen Sie sicher, dass er noch gepflegt wird.',
@@ -201,6 +202,7 @@
201202
'no_selected' => 'Kein Feed ausgewählt.',
202203
'number_entries' => '%d Artikel',
203204
'open_feed' => 'Feed %s öffnen',
205+
'path_entries_condition' => 'Condition for content retrieval', // TODO
204206
'priority' => array(
205207
'_' => 'Sichtbarkeit',
206208
'archived' => 'Nicht anzeigen (archiviert)',

app/i18n/el/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Add before existing content', // TODO
5858
'replace' => 'Replace existing content', // TODO
5959
),
60+
'content_retrieval' => 'Content retrieval', // TODO
6061
'css_cookie' => 'Use Cookies when fetching the article content', // TODO
6162
'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO
6263
'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', // TODO
6364
'css_path' => 'Article CSS selector on original website', // TODO
6465
'css_path_filter' => array(
6566
'_' => 'CSS selector of the elements to remove', // TODO
66-
'help' => 'A CSS selector may be a list such as: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>', // TODO
67+
'help' => 'A CSS selector may be a list such as: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>', // TODO
6768
),
6869
'description' => 'Description', // TODO
6970
'empty' => 'This feed is empty. Please verify that it is still maintained.', // TODO
@@ -201,6 +202,7 @@
201202
'no_selected' => 'No feed selected.', // TODO
202203
'number_entries' => '%d articles', // TODO
203204
'open_feed' => 'Open feed %s', // TODO
205+
'path_entries_condition' => 'Condition for content retrieval', // TODO
204206
'priority' => array(
205207
'_' => 'Visibility', // TODO
206208
'archived' => 'Do not show (archived)', // TODO

app/i18n/en-us/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Add before existing content', // IGNORE
5858
'replace' => 'Replace existing content', // IGNORE
5959
),
60+
'content_retrieval' => 'Content retrieval', // IGNORE
6061
'css_cookie' => 'Use Cookies when fetching the article content', // IGNORE
6162
'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // IGNORE
6263
'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', // IGNORE
6364
'css_path' => 'Article CSS selector on original website', // IGNORE
6465
'css_path_filter' => array(
6566
'_' => 'CSS selector of the elements to remove', // IGNORE
66-
'help' => 'A CSS selector may be a list such as: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>', // IGNORE
67+
'help' => 'A CSS selector may be a list such as: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>', // IGNORE
6768
),
6869
'description' => 'Description', // IGNORE
6970
'empty' => 'This feed is empty. Please verify that it is still maintained.', // IGNORE
@@ -201,6 +202,7 @@
201202
'no_selected' => 'No feed selected.', // IGNORE
202203
'number_entries' => '%d articles', // IGNORE
203204
'open_feed' => 'Open feed %s', // IGNORE
205+
'path_entries_condition' => 'Condition for content retrieval', // IGNORE
204206
'priority' => array(
205207
'_' => 'Visibility', // IGNORE
206208
'archived' => 'Do not show (archived)', // IGNORE

app/i18n/en/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Add before existing content',
5858
'replace' => 'Replace existing content',
5959
),
60+
'content_retrieval' => 'Content retrieval',
6061
'css_cookie' => 'Use Cookies when fetching the article content',
6162
'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>',
6263
'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)',
6364
'css_path' => 'Article CSS selector on original website',
6465
'css_path_filter' => array(
6566
'_' => 'CSS selector of the elements to remove',
66-
'help' => 'A CSS selector may be a list such as: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>',
67+
'help' => 'A CSS selector may be a list such as: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>',
6768
),
6869
'description' => 'Description',
6970
'empty' => 'This feed is empty. Please verify that it is still maintained.',
@@ -201,6 +202,7 @@
201202
'no_selected' => 'No feed selected.',
202203
'number_entries' => '%d articles',
203204
'open_feed' => 'Open feed %s',
205+
'path_entries_condition' => 'Condition for content retrieval',
204206
'priority' => array(
205207
'_' => 'Visibility',
206208
'archived' => 'Do not show (archived)',

app/i18n/es/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Añadir antes del contenido existente',
5858
'replace' => 'Reemplazar contenido existente',
5959
),
60+
'content_retrieval' => 'Content retrieval', // TODO
6061
'css_cookie' => 'Usar cookies al obtener el contenido del artículo',
6162
'css_cookie_help' => 'Ejemplo: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>',
6263
'css_help' => 'Recibir fuentes RSS truncadas (aviso, ¡necesita más tiempo!)',
6364
'css_path' => 'Ruta a la CSS de los artículos en la web original',
6465
'css_path_filter' => array(
6566
'_' => 'Selector CSS de los elementos a remover',
66-
'help' => 'Un selector CSS puede ser una lista, por ejemplo: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>',
67+
'help' => 'Un selector CSS puede ser una lista, por ejemplo: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>',
6768
),
6869
'description' => 'Descripción',
6970
'empty' => 'La fuente está vacía. Por favor, verifica que siga activa.',
@@ -201,6 +202,7 @@
201202
'no_selected' => 'No hay fuentes seleccionadas.',
202203
'number_entries' => '%d artículos',
203204
'open_feed' => 'Fuente abierta %s',
205+
'path_entries_condition' => 'Condition for content retrieval', // TODO
204206
'priority' => array(
205207
'_' => 'Visibilidad',
206208
'archived' => 'No mostrar (archivado)',

app/i18n/fa/sub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
'prepend' => ' قبل از محتوای موجود اضافه کنید',
5858
'replace' => ' محتوای موجود را جایگزین کنید',
5959
),
60+
'content_retrieval' => 'Content retrieval', // TODO
6061
'css_cookie' => ' هنگام واکشی محتوای مقاله از کوکی ها استفاده کنید',
6162
'css_cookie_help' => ' مثال: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>',
6263
'css_help' => ' فیدهای RSS کوتاه شده را بازیابی می کند (احتیاط',
@@ -201,6 +202,7 @@
201202
'no_selected' => ' هیچ خوراکی انتخاب نشده است.',
202203
'number_entries' => ' %d مقاله',
203204
'open_feed' => 'Open feed %s', // TODO
205+
'path_entries_condition' => 'Condition for content retrieval', // TODO
204206
'priority' => array(
205207
'_' => ' دید',
206208
'archived' => ' نشان داده نشود (بایگانی شده)',

app/i18n/fi/sub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@
5757
'prepend' => 'Lisää ennen aiempaa sisältöä',
5858
'replace' => 'Korvaa aiempi sisältö',
5959
),
60+
'content_retrieval' => 'Content retrieval', // TODO
6061
'css_cookie' => 'Käytä evästeitä noudettaessa artikkelin sisältö',
6162
'css_cookie_help' => 'Esimerkki: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>',
6263
'css_help' => 'Noutaa lyhennetyt RSS-syötteet (huomautus: kestää pidempään!)',
6364
'css_path' => 'Artikkelin CSS-valitsin alkuperäisellä sivustolla',
6465
'css_path_filter' => array(
6566
'_' => 'Poistettavien elementtien CSS-valitsin',
66-
'help' => 'CSS-valitsin voi olla luettelo, kuten: <kbd>.footer, .aside, p[data-sanitized-class="menu"]</kbd>',
67+
'help' => 'CSS-valitsin voi olla luettelo, kuten: <kbd>.footer, .aside, p[data-sanitized-class~="menu"]</kbd>',
6768
),
6869
'description' => 'Kuvaus',
6970
'empty' => 'Syöte on tyhjä. Varmista, että sitä ylläpidetään edelleen.',
@@ -201,6 +202,7 @@
201202
'no_selected' => 'Syötettä ei ole valittu.',
202203
'number_entries' => '%d artikkelia',
203204
'open_feed' => 'Avaa syöte %s',
205+
'path_entries_condition' => 'Condition for content retrieval', // TODO
204206
'priority' => array(
205207
'_' => 'Näkyvyys',
206208
'archived' => 'Älä näytä (arkistoitu)',

0 commit comments

Comments
 (0)