1st Upload
This commit is contained in:
48
Y2MateDownloaderBridge.php
Normal file
48
Y2MateDownloaderBridge.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
class Y2MateDownloaderBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'Akamaru';
|
||||
const NAME = 'Y2Mate Downloader Changelog';
|
||||
const URI = 'https://y2mate.ch/de/y2mate-downloader-changelog';
|
||||
const CACHE_TIMEOUT = 3600; // 1 hour
|
||||
const DESCRIPTION = 'Changelog for Y2Mate Downloader';
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not load content');
|
||||
|
||||
// Extract article title
|
||||
$articleTitle = $html->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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user