adjust different rss tg
This commit is contained in:
parent
897c55efd8
commit
05e0304901
|
|
@ -40,13 +40,19 @@ class TelegramLinkFixerExtension extends Minz_Extension
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First try: Look for Telegraph link with "Telegraph" text
|
||||||
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
||||||
$telegraphLink = $matches[1];
|
$telegraphLink = $matches[1];
|
||||||
if (!empty($telegraphLink)) {
|
}
|
||||||
error_log('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
// Second try: Look for any Telegraph link in the first paragraph
|
||||||
$entry->_link($telegraphLink);
|
else if (preg_match('/<p>.*?<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>/i', $description, $matches)) {
|
||||||
error_log('TelegramLinkFixer: Successfully updated link');
|
$telegraphLink = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($telegraphLink)) {
|
||||||
|
error_log('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
||||||
|
$entry->_link($telegraphLink);
|
||||||
|
error_log('TelegramLinkFixer: Successfully updated link');
|
||||||
} else {
|
} else {
|
||||||
error_log('TelegramLinkFixer: No Telegraph link found in content');
|
error_log('TelegramLinkFixer: No Telegraph link found in content');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue