1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-05 08:07:33 +02:00
This commit is contained in:
Dag
2025-08-04 01:36:15 +02:00
committed by GitHub
parent 47c9983e16
commit e5f9fe6251
2 changed files with 10 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ class ExplosmBridge extends BridgeAbstract
$html = getSimpleHTMLDOM($url); $html = getSimpleHTMLDOM($url);
$element = $html->find('[class*=ComicImage]', 0); $element = $html->find('[class*=ComicImage]', 0);
if(!$element) { if (!$element) {
break; // skip, if element was not found break; // skip, if element was not found
} }
$date = $element->find('[class^=Author__Right] p', 0)->plaintext; $date = $element->find('[class^=Author__Right] p', 0)->plaintext;

View File

@@ -1,6 +1,7 @@
<?php <?php
class WaggaCouncilBridge extends BridgeAbstract { class WaggaCouncilBridge extends BridgeAbstract
{
const NAME = 'Wagga Wagga Council'; const NAME = 'Wagga Wagga Council';
const URI = 'https://news.wagga.nsw.gov.au/'; const URI = 'https://news.wagga.nsw.gov.au/';
const DESCRIPTION = 'Wagga Wagga Council updates'; const DESCRIPTION = 'Wagga Wagga Council updates';
@@ -25,12 +26,14 @@ class WaggaCouncilBridge extends BridgeAbstract {
] ]
]; ];
public function getURI(): string { public function getURI(): string
{
$section = $this->getInput('section') ?: 'council'; $section = $this->getInput('section') ?: 'council';
return urljoin(self::URI, $section); return urljoin(self::URI, $section);
} }
public function collectData(): void { public function collectData(): void
{
$html = getSimpleHTMLDOM($this->getURI()); $html = getSimpleHTMLDOM($this->getURI());
foreach ($html->find('div.container') as $container) { foreach ($html->find('div.container') as $container) {
@@ -64,18 +67,18 @@ class WaggaCouncilBridge extends BridgeAbstract {
'.article__badge', '.article__badge',
'p.text-muted', 'p.text-muted',
]; ];
foreach ($selectorsToRemove as $sel) { foreach ($selectorsToRemove as $sel) {
foreach ($article->find($sel) as $el) { foreach ($article->find($sel) as $el) {
$el->outertext = ''; $el->outertext = '';
} }
} }
foreach ($article->find('iframe') as $iframe) { foreach ($article->find('iframe') as $iframe) {
$src = $iframe->getAttribute('src'); $src = $iframe->getAttribute('src');
$iframe->outertext = '<p><a href="' . htmlspecialchars($src) . '">Embedded content: ' . htmlspecialchars($src) . '</a></p>'; $iframe->outertext = '<p><a href="' . htmlspecialchars($src) . '">Embedded content: ' . htmlspecialchars($src) . '</a></p>';
} }
// Enhance list rendering // Enhance list rendering
foreach ($article->find('ul') as $ul) { foreach ($article->find('ul') as $ul) {
$ul->style = 'margin-left: 1em; padding-left: 1em;'; $ul->style = 'margin-left: 1em; padding-left: 1em;';