find('article') as $element) { $link = $element->find('button', 0)->getAttribute('data-link'); $datetime = $element->getAttribute('data-publication-time'); $url = self::BASEURL . $link; $title = $element->find('h2', 0)->plaintext; $author = $element->find('div.ds-byline__titles', 0)->plaintext; // Debug::log($link); // Debug::log($datetime); // Debug::log($title); // Debug::log($url); // Debug::log($author); $article_content = $element->find('div.direkt-post__content', 0); $article_html = ''; $figure = $element->find('figure', 0); if ($figure) { $article_html = $figure->find('img', 0) . '
' . $figure->find('figcaption', 0) . '
'; } foreach ($article_content->find('p') as $p) { $article_html = $article_html . $p; } $this->items[] = [ 'uri' => $url, 'title' => $title, 'author' => trim($author), 'timestamp' => $datetime, 'content' => trim($article_html), ]; if (count($this->items) > self::LIMIT) { break; } } } }