2013-08-14 03:27:46 +04:00
|
|
|
<?php
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
class CryptomeBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const MAINTAINER = 'BoboTiG';
|
|
|
|
const NAME = 'Cryptome';
|
|
|
|
const URI = 'https://cryptome.org/';
|
|
|
|
const CACHE_TIMEOUT = 21600; // 6h
|
|
|
|
const DESCRIPTION = 'Returns the N most recent documents.';
|
|
|
|
const PARAMETERS = [ [
|
|
|
|
'n' => [
|
|
|
|
'name' => 'number of elements',
|
|
|
|
'type' => 'number',
|
|
|
|
'required' => true,
|
|
|
|
'exampleValue' => 10
|
|
|
|
]
|
|
|
|
]];
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
public function getIcon()
|
|
|
|
{
|
|
|
|
return self::URI . '/favicon.ico';
|
|
|
|
}
|
2022-03-25 02:11:28 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$html = getSimpleHTMLDOM(self::URI);
|
2013-08-14 03:27:46 +04:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
$number = $this->getInput('n');
|
|
|
|
if (!empty($number)) {
|
|
|
|
$num = min($number, 20);
|
|
|
|
}
|
|
|
|
$i = 0;
|
|
|
|
foreach ($html->find('pre', 1)->find('b') as $element) {
|
|
|
|
foreach ($element->find('a') as $element1) {
|
|
|
|
$item = [];
|
|
|
|
$item['uri'] = $element1->href;
|
|
|
|
$item['title'] = $element->plaintext;
|
|
|
|
$this->items[] = $item;
|
2022-03-25 02:11:28 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
if ($i > $num) {
|
|
|
|
break 2;
|
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-14 03:27:46 +04:00
|
|
|
}
|