find('div[class="mb-16 md:flex"]') as $element) { if ($count >= self::MAX_ARTICLES) { break; } $data = $element->find('a[class="hover:text-red transition-colors duration-200"]', 0); if (!$data) { continue; } $url = $data->href; $this->items[] = [ 'content' => $this->constructContent($url), 'timestamp' => $element->find('time', 0)->datetime, 'title' => $data->plaintext, 'uid' => $url, 'uri' => $url, ]; $count++; } } private function constructContent($url) { $dom = getSimpleHTMLDOMCached($url); $article = $dom->find('div[class*="content-repository-content"]', 0); if (!$article) { return 'Content Not Found'; } // Remove ads foreach ($article->find('.inline-ad') as $remove) { $remove->outertext = ''; } return $article->innertext; } }