From 747bb6ad9ca1b0d2d03b6d93a5ea99af5830e1c7 Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 3 Sep 2020 06:18:15 +0000 Subject: [PATCH] [WosckerBridge] Add bridge (#1643) --- bridges/WosckerBridge.php | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 bridges/WosckerBridge.php diff --git a/bridges/WosckerBridge.php b/bridges/WosckerBridge.php new file mode 100644 index 00000000..7f348531 --- /dev/null +++ b/bridges/WosckerBridge.php @@ -0,0 +1,51 @@ +getURI()) + or returnServerError('Could not request: ' . $this->getURI()); + + $date = $html->find('h1', 0)->plaintext; + $timestamp = $html->find('span.dateFont', 0)->plaintext . ' ' . $html->find('span.dateFont', 1)->plaintext; + + $item = array(); + $item['title'] = $date; + $item['content'] = $this->formatContent($html); + $item['timestamp'] = $timestamp; + + $this->items[] = $item; + } + + private function formatContent($html) { + $html->find('h1', 0)->outertext = ''; + + foreach ($html->find('hr') as $hr) { + $hr->outertext = ''; + } + + foreach ($html->find('div.betweenHeadline') as $div) { + $div->outertext = ''; + } + + foreach ($html->find('div.dividingBarrier') as $div) { + $div->outertext = ''; + } + + foreach ($html->find('h2') as $h2) { + $h2->outertext = '
' . $h2->innertext . '
'; + } + + foreach ($html->find('h3') as $h3) { + $h3->outertext = $h3->innertext . '
'; + } + + return $html->find('div.fullContentPiece', 0)->innertext; + } +}