mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[CryptomeBridge] Fix pageformat (#2239)
This commit is contained in:
parent
2ade568a84
commit
943a5e3e8b
@ -6,7 +6,6 @@ class CryptomeBridge extends BridgeAbstract {
|
|||||||
const URI = 'https://cryptome.org/';
|
const URI = 'https://cryptome.org/';
|
||||||
const CACHE_TIMEOUT = 21600; //6h
|
const CACHE_TIMEOUT = 21600; //6h
|
||||||
const DESCRIPTION = 'Returns the N most recent documents.';
|
const DESCRIPTION = 'Returns the N most recent documents.';
|
||||||
|
|
||||||
const PARAMETERS = array( array(
|
const PARAMETERS = array( array(
|
||||||
'n' => array(
|
'n' => array(
|
||||||
'name' => 'number of elements',
|
'name' => 'number of elements',
|
||||||
@ -16,29 +15,30 @@ class CryptomeBridge extends BridgeAbstract {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
public function getIcon() {
|
||||||
|
return self::URI . '/favicon.ico';
|
||||||
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = getSimpleHTMLDOM(self::URI);
|
$html = getSimpleHTMLDOM(self::URI);
|
||||||
|
|
||||||
$number = $this->getInput('n');
|
$number = $this->getInput('n');
|
||||||
|
|
||||||
/* number of documents */
|
|
||||||
if(!empty($number)) {
|
if(!empty($number)) {
|
||||||
$num = min($number, 20);
|
$num = min($number, 20);
|
||||||
}
|
}
|
||||||
|
$i = 0;
|
||||||
foreach($html->find('pre') as $element) {
|
foreach($html->find('pre', 1)->find('b') as $element) {
|
||||||
for($i = 0; $i < $num; ++$i) {
|
foreach($element->find('a') as $element1) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = self::URI . substr($element->find('a', $i)->href, 20);
|
$item['uri'] = $element1->href;
|
||||||
$item['title'] = substr($element->find('b', $i)->plaintext, 22);
|
$item['title'] = $element->plaintext;
|
||||||
$item['content'] = preg_replace(
|
|
||||||
'#http://cryptome.org/#',
|
|
||||||
self::URI,
|
|
||||||
$element->find('b', $i)->innertext
|
|
||||||
);
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
|
if ($i > $num) {
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user