1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-29 19:09:56 +02:00

Add Torrent9bridge

update cpasbienbridge
This commit is contained in:
Kevin Lagaisse
2017-01-01 12:05:37 +01:00
parent a4f4447c5e
commit 41714b4c40
2 changed files with 117 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ class CpasbienBridge extends BridgeAbstract {
const MAINTAINER = "lagaisse";
const NAME = "Cpasbien Bridge";
const URI = "http://www.cpasbien.io";
const URI = "http://www.cpasbien.cm";
const CACHE_TIMEOUT = 86400; // 24h
const DESCRIPTION = "Returns latest torrents from a request query";
@@ -24,11 +24,14 @@ class CpasbienBridge extends BridgeAbstract {
if ($episode->getAttribute('class')=='ligne0' ||
$episode->getAttribute('class')=='ligne1')
{
$htmlepisode=getSimpleHTMLDOMCached($episode->find('a', 0)->getAttribute('href'));
$urlepisode = $episode->find('a', 0)->getAttribute('href');
$htmlepisode=getSimpleHTMLDOMCached($urlepisode, 86400*366*30);
$item = array();
$item['author'] = $episode->find('a', 0)->text();
$item['title'] = $episode->find('a', 0)->text();
$item['pubdate'] = $this->getCachedDate($urlepisode);
$textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1);
if (isset($textefiche)) {
$item['content'] = $textefiche->text();
@@ -50,4 +53,19 @@ class CpasbienBridge extends BridgeAbstract {
public function getName(){
return $this->getInput('q').' : '.self::NAME;
}
private function getCachedDate($url){
debugMessage('getting pubdate from url ' . $url . '');
// Initialize cache
$cache = Cache::create('FileCache');
$cache->setPath(CACHE_DIR . '/pages');
$params = [$url];
$cache->setParameters($params);
// Get cachefile timestamp
$time = $cache->getTime();
return ($time!==false?$time:time());
}
}