From 079498163ab1333760e89dca63e66b26f4f8f7a8 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Fri, 11 Aug 2023 22:09:51 +0200 Subject: [PATCH] 1st Upload --- AnimessoBridge.php | 56 ++++++++++++++++++++++++++++++++ EvercadeBridge.php | 48 +++++++++++++++++++++++++++ FoodwatchBridge.php | 48 +++++++++++++++++++++++++++ KAZENewsBridge.php | 48 +++++++++++++++++++++++++++ KemonoFriendsMusicNewsBridge.php | 40 +++++++++++++++++++++++ ThumbzillaFeedBridge.php | 43 ++++++++++++++++++++++++ Y2MateDownloaderBridge.php | 48 +++++++++++++++++++++++++++ 7 files changed, 331 insertions(+) create mode 100644 AnimessoBridge.php create mode 100644 EvercadeBridge.php create mode 100644 FoodwatchBridge.php create mode 100644 KAZENewsBridge.php create mode 100644 KemonoFriendsMusicNewsBridge.php create mode 100644 ThumbzillaFeedBridge.php create mode 100644 Y2MateDownloaderBridge.php diff --git a/AnimessoBridge.php b/AnimessoBridge.php new file mode 100644 index 0000000..0a91b92 --- /dev/null +++ b/AnimessoBridge.php @@ -0,0 +1,56 @@ + array( + 'name' => 'Search ID', + 'required' => true, + 'exampleValue' => '6681897' + ), + )); + + public function getIcon(){ + return 'https://cdn.animes.so/styles/animesso/logo.og.png'; + } + + public function collectData() { + $id = $this->getInput('id'); + // Retrieve webpage + $pageUrl = self::URI . 'suche/' . $id . '//?o=date&c[title_only]=1'; + $html = getSimpleHTMLDOM($pageUrl) + or returnServerError('Could not request webpage: ' . $pageUrl); + + // Process articles + foreach($html->find('div.listBlock.main') as $element) { + + if(count($this->items) >= 10) { + break; + } + + $article_title = trim($element->find('h3', 0)->innertext); + //$article_thumbnail = $element->find('a', 0)->data-thumbnailurl; + $article_uri = $element->find('h3 a', 0)->href; + + //$article_content = '
'; + $article_content = trim(strip_tags($element->find('blockquote.snippet', 0)->innertext)); + $article_uid = trim(strip_tags($element->find('h3', 0)->innertext)); + + // Store article in items array + if (!empty($article_title)) { + $item = array(); + $item['uri'] = self::URI . $article_uri; + $item['title'] = $article_title; + //$item['enclosures'] = array($article_thumbnail); + $item['content'] = $article_content; + $item['uid'] = $article_uid; + $this->items[] = $item; + } + } + } +} diff --git a/EvercadeBridge.php b/EvercadeBridge.php new file mode 100644 index 0000000..619607c --- /dev/null +++ b/EvercadeBridge.php @@ -0,0 +1,48 @@ +find('div.an-article') as $element) { + + if(count($this->items) >= 10) { + break; + } + + $article_title = trim(strip_tags($element->find('h2', 0)->innertext)); + $article_uri = substr($element->find('a', 0)->href, 0); + //$article_thumbnail = self::URI . substr($element->find('img', 0)->src, 3); + //$article_content = ''; + $article_content = trim(strip_tags($element->find('p.excerpt', 0)->innertext)); + //$article_timestamp = strtotime($element->find('time', 0)->attr['datetime']); + $article_uid = trim(strip_tags($element->find('h2', 0)->innertext)); + + // Store article in items array + if (!empty($article_title)) { + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + //$item['enclosures'] = array($article_thumbnail); + $item['content'] = $article_content; + //$item['timestamp'] = $article_timestamp; + $item['uid'] = $article_uid; + $this->items[] = $item; + } + } + } +} diff --git a/FoodwatchBridge.php b/FoodwatchBridge.php new file mode 100644 index 0000000..32ffddb --- /dev/null +++ b/FoodwatchBridge.php @@ -0,0 +1,48 @@ +find('div.list-teaser__content') as $element) { + + if(count($this->items) >= 10) { + break; + } + + $article_title = trim(strip_tags($element->find('h3', 0)->innertext)); + $article_uri = self::URI . substr($element->find('a', 0)->href, 0); + //$article_thumbnail = self::URI . substr($element->find('img', 0)->src, 3); + //$article_content = ''; + $article_content = trim(strip_tags($element->find('div.list-teaser__main', 0)->innertext)); + //$article_timestamp = strtotime($element->find('time', 0)->attr['datetime']); + $article_uid = trim(strip_tags($element->find('div.list-teaser__meta', 0)->innertext)); + + // Store article in items array + if (!empty($article_title)) { + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + //$item['enclosures'] = array($article_thumbnail); + $item['content'] = $article_content; + //$item['timestamp'] = $article_timestamp; + $item['uid'] = $article_uid; + $this->items[] = $item; + } + } + } +} diff --git a/KAZENewsBridge.php b/KAZENewsBridge.php new file mode 100644 index 0000000..32508d4 --- /dev/null +++ b/KAZENewsBridge.php @@ -0,0 +1,48 @@ +find('div.kaze-news-list__item') as $element) { + + if(count($this->items) >= 10) { + break; + } + + $article_title = trim(strip_tags($element->find('div.kaze-news-list-item__title', 0)->innertext)); + $article_uri = self::URI . substr($element->find('a', 0)->href, 0); + $article_thumbnail = substr($element->find('img', 0)->src, 0); + //$article_content = ''; + $article_content = trim(strip_tags($element->find('div.kaze-news-list-item__descr', 0)->innertext)); + //$article_timestamp = strtotime($element->find('time', 0)->attr['datetime']); + $article_uid = trim(strip_tags($element->find('span.kaze-news-list-item__date', 0)->innertext)); + + // Store article in items array + if (!empty($article_title)) { + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + $item['enclosures'] = array($article_thumbnail); + $item['content'] = $article_content; + //$item['timestamp'] = $article_timestamp; + $item['uid'] = $article_uid; + $this->items[] = $item; + } + } + } +} diff --git a/KemonoFriendsMusicNewsBridge.php b/KemonoFriendsMusicNewsBridge.php new file mode 100644 index 0000000..0f3e3eb --- /dev/null +++ b/KemonoFriendsMusicNewsBridge.php @@ -0,0 +1,40 @@ +find('ul.l_newslink li') as $element) { + + if(count($this->items) >= 10) { + break; + } + + $article_title = trim(strip_tags($element->find('p.newslink_txt', 0)->innertext)); + $article_uri = self::URI . substr($element->find('a', 0)->href, 0); + + // strtotime() doesn't seem to like the missing zeroes in the month + $article_time = trim(strip_tags($element->find('div.newslink_date', 0)->innertext)); + $article_timestamp = date_format(date_create_from_format("Y.m.d", $article_time), "d.m.Y"); + + // Store article in items array + if (!empty($article_title)) { + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + $item['timestamp'] = $article_timestamp; + $this->items[] = $item; + } + + } + } +} \ No newline at end of file diff --git a/ThumbzillaFeedBridge.php b/ThumbzillaFeedBridge.php new file mode 100644 index 0000000..cfb855c --- /dev/null +++ b/ThumbzillaFeedBridge.php @@ -0,0 +1,43 @@ +find('a.js-thumb') as $element) { + + if(count($this->items) >= 10) { + break; + } + + $article_title = trim(strip_tags($element->find('span.title', 0)->innertext)); + $article_thumbnail = substr($element->find('img', 0)->src, 0); + $article_content = ''; + $article_uid = trim(strip_tags($element->find('span.title', 0)->innertext)); + + // Store article in items array + if (!empty($article_title)) { + $item = array(); + $item['uri'] = $pageUrl; + $item['title'] = $article_title; + $item['content'] = $article_content; + $item['uid'] = $article_uid; + $this->items[] = $item; + } + } + } +} diff --git a/Y2MateDownloaderBridge.php b/Y2MateDownloaderBridge.php new file mode 100644 index 0000000..4cd6b88 --- /dev/null +++ b/Y2MateDownloaderBridge.php @@ -0,0 +1,48 @@ +find('h2.title.tc', 0)->innertext; + $edition = $html->find('p.edition.tc', 0)->innertext; + $articleTitle = $articleTitle . ' ' . $edition; + + // Extract article content + $articleContent = $html->find('div.list', 0)->innertext; + + // Extract release date + $releaseDate = $html->find('p.tc.time', 0)->innertext; + $releaseDate = str_replace('Freigegeben am', '', $releaseDate); + + // Extract article uid + $articleUid = $edition; + + // Build the item + $item = array(); + $item['uri'] = self::URI; + $item['title'] = $articleTitle; + $item['timestamp'] = strtotime($releaseDate); + $item['content'] = $articleContent; + $item['uid'] = $articleUid; + + // Add the item to the feed + $this->items[] = $item; + } + + public function getName() { + return self::NAME; + } + + public function getURI() { + return self::URI; + } +} \ No newline at end of file