Skip to content

Commit 744f996

Browse files
authored
Added bridge for Toms Touché (https://taz.de/#!tom=tomdestages) (#4438)
1 parent f270cd3 commit 744f996

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

bridges/TomsToucheBridge.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
class TomsToucheBridge extends BridgeAbstract
4+
{
5+
const NAME = 'Toms Touché';
6+
const URI = 'https://taz.de/#!tom=tomdestages';
7+
const DESCRIPTION = 'Your daily dose of Toms Touche.';
8+
const MAINTAINER = 'latz';
9+
const CACHE_TIMEOUT = 3600; // 1h
10+
11+
public function collectData()
12+
{
13+
$url = 'https://taz.de/';
14+
$html = getSimpleHTMLDOM($url); // Docs: https://simplehtmldom.sourceforge.io/docs/1.9/index.html
15+
$date = $html->find('p[x-ref]');
16+
$date = trim($date[0]->innertext);
17+
[$day, $month, $year] = explode('.', $date);
18+
$image = $html->find('img[alt="tom des tages"]');
19+
20+
$item = [];
21+
$item['title'] = "Toms Touché - $date";
22+
$item['uri'] = 'https://taz.de/#!tom=tomdestages';
23+
$item['timestamp'] = mktime(0, 0, 0, $month, $day, $year);
24+
$item['content'] = $image[0] . '</img>'; // This isn't good HTML style, but at least syntactically correct
25+
$item['uid'] = $image[0]->getAttribute('src');
26+
$this->items[] = $item;
27+
}
28+
}

0 commit comments

Comments
 (0)