From e9d3a657bab09c6fbe8e7d4002cdcb5215054bf4 Mon Sep 17 00:00:00 2001 From: Tobias Alexander Franke Date: Thu, 15 Aug 2024 00:47:39 +0200 Subject: [PATCH] [EASeedBridge] New bridge for the EA Seed blog (#4216) * [EASeedBridge] New bridge for the EA Seed blog * Fix linter issues --- bridges/EASeedBridge.php | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bridges/EASeedBridge.php diff --git a/bridges/EASeedBridge.php b/bridges/EASeedBridge.php new file mode 100644 index 00000000000..bb5fa41d11c --- /dev/null +++ b/bridges/EASeedBridge.php @@ -0,0 +1,42 @@ +find('ea-grid', 0); + if (!$dom) { + throw new \Exception(sprintf('Unable to find css selector on `%s`', $url)); + } + $dom = defaultLinkTo($dom, $this->getURI()); + foreach ($dom->find('ea-tile') as $article) { + $a = $article->find('a', 0); + $date = $article->find('div', 1)->plaintext; + $title = $article->find('h3', 0)->plaintext; + $author = $article->find('div', 0)->plaintext; + + $entry = getSimpleHTMLDOMCached($a->href, static::CACHE_TIMEOUT * 7 * 4); + + $content = $entry->find('main', 0); + + // remove header and links to other posts + $content->find('ea-header', 0)->outertext = ''; + $content->find('ea-section', -1)->outertext = ''; + + $this->items[] = [ + 'title' => $title, + 'author' => $author, + 'uri' => $a->href, + 'content' => $content, + 'timestamp' => strtotime($date), + ]; + } + } +}