From 28f5066fc4d8c4fc84f620bd0bd7fd30c55dded9 Mon Sep 17 00:00:00 2001 From: quickwick <2566133+quickwick@users.noreply.github.com> Date: Sun, 3 Apr 2022 01:10:56 -0700 Subject: [PATCH] Delete broken, unneeded bridges (#2595) --- bridges/ABCTabsBridge.php | 42 ----------------------------- bridges/LichessBridge.php | 31 --------------------- bridges/SupInfoBridge.php | 57 --------------------------------------- bridges/WosckerBridge.php | 50 ---------------------------------- 4 files changed, 180 deletions(-) delete mode 100644 bridges/ABCTabsBridge.php delete mode 100644 bridges/LichessBridge.php delete mode 100644 bridges/SupInfoBridge.php delete mode 100644 bridges/WosckerBridge.php diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php deleted file mode 100644 index ef2c75b1..00000000 --- a/bridges/ABCTabsBridge.php +++ /dev/null @@ -1,42 +0,0 @@ -find('table#myTable', 0)->children(1); - - foreach ($table->find('tr') as $tab) { - $item = array(); - $item['author'] = $tab->find('td', 1)->plaintext - . ' - ' - . $tab->find('td', 2)->plaintext; - - $item['title'] = $tab->find('td', 1)->plaintext - . ' - ' - . $tab->find('td', 2)->plaintext; - - $item['content'] = 'Le ' - . $tab->find('td', 0)->plaintext - . '
Par: ' - . $tab->find('td', 5)->plaintext - . '
Type: ' - . $tab->find('td', 3)->plaintext; - - $item['id'] = static::URI - . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); - - $item['uri'] = static::URI - . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); - - $this->items[] = $item; - } - } -} diff --git a/bridges/LichessBridge.php b/bridges/LichessBridge.php deleted file mode 100644 index bf7369fb..00000000 --- a/bridges/LichessBridge.php +++ /dev/null @@ -1,31 +0,0 @@ -collectExpandableDatas(self::URI . '.atom', 5); - } - - protected function parseItem($newsItem){ - $item = parent::parseItem($newsItem); - $item['content'] = $this->retrieveLichessPost($item['uri']); - return $item; - } - - private function retrieveLichessPost($blog_post_uri){ - $blog_post_html = getSimpleHTMLDOMCached($blog_post_uri); - $blog_post_div = $blog_post_html->find('#lichess_blog', 0); - - $post_chapo = $blog_post_div->find('.shortlede', 0)->innertext; - $post_content = $blog_post_div->find('.body', 0)->innertext; - - $content = '

' . $post_chapo . '

'; - $content .= '
' . $post_content . '
'; - - return $content; - } -} diff --git a/bridges/SupInfoBridge.php b/bridges/SupInfoBridge.php deleted file mode 100644 index a2b9fc0b..00000000 --- a/bridges/SupInfoBridge.php +++ /dev/null @@ -1,57 +0,0 @@ - array( - 'name' => 'Category (not mandatory)', - 'type' => 'text', - ) - )); - - public function getIcon() { - return self::URI . '/favicon.png'; - } - - public function collectData() { - - if(empty($this->getInput('tag'))) { - $html = getSimpleHTMLDOM(self::URI . '/articles/'); - } else { - $html = getSimpleHTMLDOM(self::URI . '/articles/tag/' . $this->getInput('tag')); - } - $content = $html->find('#latest', 0)->find('ul[class=courseContent]', 0); - - for($i = 0; $i < 5; $i++) { - - $this->items[] = $this->fetchArticle($content->find('h4', $i)->find('a', 0)->href); - - } - } - - private function fetchArticle($link) { - - $articleHTML = getSimpleHTMLDOM(self::URI . $link); - - $article = $articleHTML->find('div[id=courseDocZero]', 0); - $item = array(); - $item['author'] = $article->find('#courseMetas', 0)->find('a', 0)->plaintext; - $item['id'] = $link; - $item['uri'] = self::URI . $link; - $item['title'] = $article->find('h1', 0)->plaintext; - $date = explode(' ', $article->find('#courseMetas', 0)->find('span', 1)->plaintext); - $item['timestamp'] = DateTime::createFromFormat('d/m/Y H:i:s', $date[2] . ' ' . $date[4])->getTimestamp(); - - $article->find('div[id=courseHeader]', 0)->innertext = ''; - $article->find('div[id=author-infos]', 0)->innertext = ''; - $article->find('div[id=cartouche-tete]', 0)->innertext = ''; - $item['content'] = $article; - - return $item; - - } -} diff --git a/bridges/WosckerBridge.php b/bridges/WosckerBridge.php deleted file mode 100644 index 694f69b1..00000000 --- a/bridges/WosckerBridge.php +++ /dev/null @@ -1,50 +0,0 @@ -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; - } -}