getscraperfilters("music");
$get = $frontend->parsegetfilters($_GET, $filters);
$frontend->loadheader(
$get,
$filters,
"music"
);
$payload = [
"class" => "",
"right-left" => "",
"right-right" => "",
"left" => ""
];
try{
$results = $scraper->music($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();
}
$categories = [
"song" => "",
"author" => "",
"playlist" => ""
];
/*
Set the main container
*/
$main = null;
if(count($results["song"]) !== 0){
$main = "song";
}elseif(count($results["author"]) !== 0){
$main = "author";
}elseif(count($results["playlist"]) !== 0){
$main = "playlist";
}else{
// No results found!
echo
$frontend->drawerror(
"Nobody here but us chickens!",
'Have you tried:' .
'' .
'- Using a different scraper
' .
'- Using fewer keywords
' .
'- Defining broader filters (Is NSFW turned off?)
' .
'
' .
''
);
die();
}
/*
Generate list of songs
*/
foreach($categories as $name => $data){
foreach($results[$name] as $item){
$greentext = [];
if(
isset($item["date"]) &&
$item["date"] !== null
){
$greentext[] = date("jS M y @ g:ia", $item["date"]);
}
if(
isset($item["views"]) &&
$item["views"] !== null
){
$views = number_format($item["views"]) . " views";
$greentext[] = $views;
}
if(
isset($item["followers"]) &&
$item["followers"] !== null
){
$greentext[] = number_format($item["followers"]) . " followers";
}
if(
isset($item["author"]["name"]) &&
$item["author"]["name"] !== null
){
$greentext[] = $item["author"]["name"];
}
$greentext = implode(" • ", $greentext);
if(
isset($item["duration"]) &&
$item["duration"] !== null
){
$duration = $frontend->s_to_timestamp($item["duration"]);
}else{
$duration = null;
}
$tabindex = $name == $main ? true : false;
$customhtml = null;
if(
$name == "song" &&
$item["stream"]["endpoint"] !== null
){
$customhtml =
'