1
0

Neu: waipu.tv Magazin Bridge

This commit is contained in:
Akamaru
2026-01-09 16:58:43 +01:00
parent 93cd079912
commit b632fe00a1
2 changed files with 142 additions and 0 deletions

View File

@@ -345,6 +345,14 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u
- Links führen zur offiziellen Streaming-Seite (wenn verfügbar)
- Autor wird auf den Streaming-Dienst gesetzt (z.B. "Prime Video")
### [waipu.tv Magazin Bridge](https://bridge.ponywave.de/#bridge-WaipuTvMagazinBridge) (Von Akamaru)
- **Beschreibung**: Aktuelle News und Artikel von waipu.tv Magazin
- **Hinweise**:
- Zeigt bis zu 20 aktuelle Artikel
- Enthält Titel, Datum, Kategorien (z.B. "TV-News", "Ratgeber", "TV-Technik"), Beschreibung und Bilder
- Datum wird im deutschen Format (DD.MM.YYYY) extrahiert
- Autor ist auf "waipu.tv" gesetzt
### [Warner Bros. Discovery Deutschland Bridge](https://bridge.ponywave.de/#bridge-WarnerBrosDiscoveryBridge) (Von Akamaru)
- **Beschreibung**: Pressemitteilungen von Warner Bros. Discovery Deutschland
- **Hinweise**:

134
WaipuTvMagazinBridge.php Normal file
View File

@@ -0,0 +1,134 @@
<?php
declare(strict_types=1);
class WaipuTvMagazinBridge extends BridgeAbstract
{
const NAME = 'waipu.tv Magazin';
const URI = 'https://www.waipu.tv/magazin/';
const DESCRIPTION = 'Aktuelle News und Artikel von waipu.tv Magazin';
const MAINTAINER = 'akamaru';
const CACHE_TIMEOUT = 3600; // 1 Stunde
public function getIcon()
{
return 'https://www.google.com/s2/favicons?domain=www.waipu.tv&sz=32';
}
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI);
if (!$html) {
throw new \Exception('Konnte waipu.tv Magazin nicht laden');
}
// Finde alle Artikel
$articles = $html->find('div.newsroom-container div.news-item');
if (empty($articles)) {
throw new \Exception('Keine Artikel gefunden');
}
foreach ($articles as $article) {
$item = [];
// Titel extrahieren
$titleElement = $article->find('.wysiwyg-headline h3', 0);
if (!$titleElement) {
continue; // Überspringe Artikel ohne Titel
}
$item['title'] = trim($titleElement->plaintext);
// Link extrahieren
$linkElement = $article->find('a.stretched-link', 0);
if (!$linkElement) {
continue; // Überspringe Artikel ohne Link
}
$item['uri'] = $linkElement->href;
// Stelle sicher, dass die URL absolut ist
if (strpos($item['uri'], 'http') !== 0) {
$item['uri'] = self::URI . ltrim($item['uri'], '/');
}
// Bild extrahieren
$imageElement = $article->find('.newsroom-img img', 0);
$imageUrl = null;
if ($imageElement && isset($imageElement->src) && strpos($imageElement->src, 'data:image') !== 0) {
$imageUrl = $imageElement->src;
// Stelle sicher, dass die URL absolut ist
if (strpos($imageUrl, 'http') !== 0) {
$imageUrl = 'https://www.waipu.tv' . ltrim($imageUrl, '/');
}
$item['enclosures'] = [$imageUrl];
}
// Content zusammenbauen: Bild + Text
$content = '';
// Füge Bild hinzu
if ($imageUrl) {
$content .= '<img src="' . htmlspecialchars($imageUrl) . '" alt="' . htmlspecialchars($item['title']) . '"><br><br>';
}
// Füge Text-Excerpt hinzu
$contentElement = $article->find('.wysiwyg-text p', 0);
if ($contentElement) {
$contentText = trim($contentElement->plaintext);
$content .= '<p>' . htmlspecialchars($contentText) . '</p>';
}
$item['content'] = $content;
// Datum extrahieren (DD.MM.YYYY Format)
$dateElement = $article->find('.newsroom-date span', 0);
if ($dateElement) {
$dateText = trim($dateElement->plaintext);
// Extrahiere DD.MM.YYYY mit Regex
if (preg_match('/(\d{2})\.(\d{2})\.(\d{4})/', $dateText, $matches)) {
$day = $matches[1];
$month = $matches[2];
$year = $matches[3];
// Erstelle Timestamp
$item['timestamp'] = strtotime("$year-$month-$day");
}
}
// Fallback auf aktuelle Zeit, falls Datum nicht gefunden
if (!isset($item['timestamp'])) {
$item['timestamp'] = time();
}
// Kategorien extrahieren
$categoryElements = $article->find('.tags a');
if (!empty($categoryElements)) {
$categories = [];
foreach ($categoryElements as $catElement) {
$category = trim($catElement->plaintext);
if (!empty($category)) {
$categories[] = $category;
}
}
if (!empty($categories)) {
$item['categories'] = $categories;
}
}
// Autor setzen
$item['author'] = 'waipu.tv';
$this->items[] = $item;
// Limitiere auf 20 Artikel
if (count($this->items) >= 20) {
break;
}
}
}
}