getscraperfilters("news");
$get = $frontend->parsegetfilters($_GET, $filters);
$frontend->loadheader(
$get,
$filters,
"news"
);
$payload = [
"class" => "",
"right-left" => "",
"right-right" => "",
"left" => ""
];
try{
$results = $scraper->news($get);
}catch(Exception $error){
echo
$frontend->drawerror(
"Shit",
'This scraper returned an error:' .
'
' . htmlspecialchars($error->getMessage()) . '
' .
'Things you can try:' .
'' .
'- Use a different scraper
' .
'- Remove keywords that could cause errors
' .
'- Use another 4get instance
' .
'
' .
'If the error persists, please contact the administrator.'
);
die();
}
/*
Populate links
*/
if(count($results["news"]) === 0){
$payload["left"] =
'' .
"
Nobody here but us chickens!
" .
'Have you tried:' .
'
' .
'- Using a different scraper
' .
'- Using fewer keywords
' .
'- Defining broader filters (Is NSFW turned off?)
' .
'
' .
'
';
}
foreach($results["news"] as $news){
$greentext = [];
if($news["date"] !== null){
$greentext[] = date("jS M y @ g:ia", $news["date"]);
}
if($news["author"] !== null){
$greentext[] = htmlspecialchars($news["author"]);
}
if(count($greentext) !== 0){
$greentext = implode(" • ", $greentext);
}else{
$greentext = null;
}
$n = null;
$payload["left"] .= $frontend->drawtextresult($news, $greentext, $n, $get["s"]);
}
if($results["npt"] !== null){
$payload["left"] .=
'Next page >';
}
echo $frontend->load("search.html", $payload);