diff --git a/xExtension-replaceEntryUrl/extension.php b/xExtension-replaceEntryUrl/extension.php
new file mode 100644
index 0000000..0066fb8
--- /dev/null
+++ b/xExtension-replaceEntryUrl/extension.php
@@ -0,0 +1,158 @@
+registerHook('entry_before_display', [self::class, 'processEntry']);
+ $this->registerHook('entry_before_insert', [self::class, 'processEntry']);
+ if (FreshRSS_Context::userConf()->attributeString('replaceEntryUrl_matchUrlKeyValues') === null) {
+ FreshRSS_Context::userConf()->_attribute('replaceEntryUrl_matchUrlKeyValues', self::ALLOWED_LIST);
+ $save = true;
+ }
+ if (FreshRSS_Context::userConf()->attributeBool('replaceEntryUrl_filterXPathContent') === null) {
+ FreshRSS_Context::userConf()->_attribute('replaceEntryUrl_filterXPathContent', self::GET_FULL_CONTENT);
+ $save = true;
+ }
+ }
+
+ /**
+ * @throws FreshRSS_Context_Exception
+ */
+ public function handleConfigureAction(): void {
+ $this->registerTranslates();
+
+ if (Minz_Request::isPost()) {
+ FreshRSS_Context::userConf()->_attribute('replaceEntryUrl_matchUrlKeyValues', Minz_Request::paramString('replaceEntryUrl_matchUrlKeyValues', plaintext: true) ?: self::ALLOWED_LIST);
+ FreshRSS_Context::userConf()->_attribute('replaceEntryUrl_filterXPathContent', Minz_Request::paramBoolean('replaceEntryUrl_filterXPathContent'));
+ FreshRSS_Context::userConf()->save();
+ }
+ }
+
+ /**
+ * Process the feed content before inserting the feed
+ * @param FreshRSS_Entry $entry RSS article
+ * @return FreshRSS_Entry Processed entries
+ * @throws FreshRSS_Context_Exception
+ */
+ public static function processEntry(FreshRSS_Entry $entry): FreshRSS_Entry {
+ $old_hash = $entry->hash();
+ $use_default_if_empty = FreshRSS_Context::userConf()->attributeBool('replaceEntryUrl_filterXPathContent') ?? self::GET_FULL_CONTENT;
+ $allow_array = "";
+ $allow_url_str = FreshRSS_Context::userConf()->attributeString('replaceEntryUrl_matchUrlKeyValues');
+ if (!is_string($allow_url_str) || $allow_url_str === '') {
+ return $entry;
+ }
+ $allow_array = json_decode($allow_url_str,true);
+
+ $allow_url = [];
+
+ if(json_last_error() === JSON_ERROR_NONE && is_array($allow_array)){
+ foreach ($allow_array as $key => $value) {
+ array_push($allow_url, (string)$key);
+ }
+ }
+ if(!is_array($allow_array)){
+ return $entry;
+ }
+
+ $link = $entry->link();
+ $my_xpath = self::isUrlAllowed($link,$allow_url,$allow_array);
+
+ if (empty($my_xpath)) {
+ return $entry;
+ }
+ $response = self::curlDownloadContent($link);
+ $article = "";
+ if($response != false){
+ $article = self:: extractMainContent($response,$my_xpath,$use_default_if_empty);
+ }
+ if($article != ""){
+ $entry->_content ($article);
+ $entry->_hash($old_hash);
+ }
+ return $entry;
+ }
+
+ public static function curlDownloadContent(string $link): string|false {
+
+ $ch = curl_init();
+ if ($ch === false) {
+ throw new RuntimeException('Failed to initialize cURL.');
+ }
+ if ($link !== '') {
+ curl_setopt($ch, CURLOPT_URL, $link);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_ENCODING, "gzip, deflate");
+ //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
+ $response = curl_exec($ch);
+ if (curl_errno($ch)) {
+ error_log('cURL Error: ' . curl_error($ch));
+ $response = false;
+ }
+ curl_close($ch);
+ if ($response !== false && is_string($response)) {
+ return $response;
+ }
+ }
+ return false;
+
+ }
+
+ public static function extractMainContent(string $content,string $my_xpath,bool $use_default_if_empty): string {
+ $doc = new DOMDocument();
+ libxml_use_internal_errors(true);
+ $doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
+
+ $xpath = new DOMXPath($doc);
+ $nodes = $xpath->query($my_xpath);
+ $mainContent = "";
+ if ($nodes instanceof DOMNodeList && $nodes->length > 0) {
+ foreach ($nodes as $node) {
+ $mainContent .= $doc->saveHTML($node); // Concatenate all node contents
+ }
+ }
+ elseif($use_default_if_empty)
+ {
+ $mainContent = $content;
+ }
+ libxml_clear_errors();
+ return is_string($mainContent) ? $mainContent : '';
+ }
+ /**
+ * @param string $url
+ * @param list