diff --git a/bridges/FDroidBridge.php b/bridges/FDroidBridge.php deleted file mode 100644 index fdf0262f..00000000 --- a/bridges/FDroidBridge.php +++ /dev/null @@ -1,72 +0,0 @@ - [ - 'name' => 'Widget selection', - 'type' => 'list', - 'values' => [ - 'Latest added apps' => 'added', - 'Latest updated apps' => 'updated' - ] - ] - ]]; - - public function getIcon() - { - return self::URI . 'assets/favicon.ico'; - } - - private function getTimestamp($url) - { - $curlOptions = [ - CURLOPT_CUSTOMREQUEST => 'HEAD', - CURLOPT_NOBODY => true, - ]; - $reponse = getContents($url, [], $curlOptions, true); - $lastModified = $reponse->getHeader('last-modified'); - $timestamp = strtotime($lastModified ?? 'today'); - return $timestamp; - } - - public function collectData() - { - $url = self::URI; - $html = getSimpleHTMLDOM($url); - - // targetting the corresponding widget based on user selection - // "updated" is the 5th widget on the page, "added" is the 6th - - switch ($this->getInput('u')) { - case 'updated': - $html_widget = $html->find('div.sidebar-widget', 5); - break; - default: - $html_widget = $html->find('div.sidebar-widget', 6); - break; - } - - // and now extracting app info from the selected widget (and yeah turns out icons are of heterogeneous sizes) - - foreach ($html_widget->find('a') as $element) { - $item = []; - $item['uri'] = self::URI . $element->href; - $item['title'] = $element->find('h4', 0)->plaintext; - $item['icon'] = $element->find('img', 0)->src; - $item['timestamp'] = $this->getTimestamp($item['icon']); - $item['summary'] = $element->find('span.package-summary', 0)->plaintext; - $item['content'] = ' - - -
' . $item['summary']; - $this->items[] = $item; - } - } -}