summaryrefslogtreecommitdiff
path: root/config/services/web/rss/FipAlbumsBridge.php
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2022-12-20 22:29:55 +0100
committerQuentin Aristote <quentin@aristote.fr>2022-12-20 22:29:55 +0100
commit95644485ac1402a8dc84c520a3ded7b29720f950 (patch)
treec124a795dba03106cadff1645c532f6251898f86 /config/services/web/rss/FipAlbumsBridge.php
parent51df83cffaa45130f94bf5ab78b6b14fbb37ec4d (diff)
parent9bde3c4624eb916bafcf9a18792edb42e3a25a17 (diff)
Merge branch 'master' into searx-engine-alternativeto
Diffstat (limited to 'config/services/web/rss/FipAlbumsBridge.php')
-rw-r--r--config/services/web/rss/FipAlbumsBridge.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/config/services/web/rss/FipAlbumsBridge.php b/config/services/web/rss/FipAlbumsBridge.php
new file mode 100644
index 0000000..b8ec64d
--- /dev/null
+++ b/config/services/web/rss/FipAlbumsBridge.php
@@ -0,0 +1,41 @@
+<?php
+
+class FipAlbumsBridge extends XPathAbstract {
+ const NAME = 'Fip Albums Bridge';
+ const URI = 'https://www.radiofrance.fr/fip/albums/';
+ const DESCRIPTION = 'Albums promoted by Fip.';
+ const MAINTAINER = 'Quentin Aristote';
+ const CACHE_TIMEOUT = 86400; // 6h
+
+ const PARAMETERS = [
+ '' => [
+ 'category' => [
+ 'name' => 'Category',
+ 'type' => 'text',
+ 'description' => 'See examples for available options.',
+ 'exampleValue' => 'can be empty, "selections" or "album-jazz-de-la-semaine"'
+ ]
+ ]
+ ];
+
+ const XPATH_EXPRESSION_ITEM = '//div[starts-with(@class, "CardAlbum ")]';
+ const XPATH_EXPRESSION_ITEM_TITLE = './/a/@title';
+ const XPATH_EXPRESSION_ITEM_CONTENT = './/img/@alt';
+ const XPATH_EXPRESSION_ITEM_URI = './/a/@href';
+ const XPATH_EXPRESSION_ITEM_AUTHOR = './/div[starts-with(@class, "CardAlbum-details ")]/div[2]';
+ const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime';
+ const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src';
+ const XPATH_EXPRESSION_ITEM_CATEGORIES = './/div[starts-with(@class, "CardDetails-label ")]/span[2]';
+
+ public function getSourceUrl() {
+ return self::URI . $this->getInput('category');
+ }
+
+ public function getIcon() {
+ return 'https://www.radiofrance.fr/dist/favicons/fip/favicon.png';
+ }
+
+ protected function formatItemTimestamp($value) {
+ return strtotime('today +' . $value);
+ }
+}