bypass soundclouds recent bullshit
This commit is contained in:
@@ -142,6 +142,7 @@ class config{
|
|||||||
const PROXY_MARGINALIA = false;
|
const PROXY_MARGINALIA = false;
|
||||||
const PROXY_MOJEEK = false;
|
const PROXY_MOJEEK = false;
|
||||||
const PROXY_SC = false; // soundcloud
|
const PROXY_SC = false; // soundcloud
|
||||||
|
const PROXY_SWISSCOWS = false;
|
||||||
const PROXY_SPOTIFY = false;
|
const PROXY_SPOTIFY = false;
|
||||||
const PROXY_SOLOFIELD = false;
|
const PROXY_SOLOFIELD = false;
|
||||||
const PROXY_WIBY = false;
|
const PROXY_WIBY = false;
|
||||||
|
|||||||
793
lib/frontend.php
793
lib/frontend.php
@@ -446,407 +446,419 @@ class frontend{
|
|||||||
Add favicon
|
Add favicon
|
||||||
*/
|
*/
|
||||||
$host = parse_url($link);
|
$host = parse_url($link);
|
||||||
$esc =
|
|
||||||
explode(
|
|
||||||
".",
|
|
||||||
$host["host"],
|
|
||||||
2
|
|
||||||
);
|
|
||||||
|
|
||||||
if(
|
// special case for when we're not drawing a full url
|
||||||
count($esc) === 2 &&
|
if(!isset($host["host"])){
|
||||||
$esc[0] == "www"
|
|
||||||
){
|
|
||||||
|
|
||||||
$esc = $esc[1];
|
$payload =
|
||||||
|
'<div class="url">' .
|
||||||
|
'<button class="favicon" tabindex="-1">' .
|
||||||
|
'<img src="/favicon?s=404" alt="xx">' .
|
||||||
|
'</button>';
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$esc = $esc[0];
|
$esc =
|
||||||
}
|
explode(
|
||||||
|
".",
|
||||||
$esc = substr($esc, 0, 2);
|
$host["host"],
|
||||||
|
2
|
||||||
$urlencode = urlencode($link);
|
);
|
||||||
|
|
||||||
$payload =
|
|
||||||
'<div class="url">' .
|
|
||||||
'<button class="favicon" tabindex="-1">' .
|
|
||||||
'<img src="/favicon?s=' . htmlspecialchars($host["scheme"] . "://" . $host["host"]) . '" alt="' . htmlspecialchars($esc) . '">' .
|
|
||||||
//'<img src="/404.php" alt="' . htmlspecialchars($esc) . '">' .
|
|
||||||
'</button>' .
|
|
||||||
'<div class="favicon-dropdown">';
|
|
||||||
|
|
||||||
/*
|
|
||||||
Add archive links
|
|
||||||
*/
|
|
||||||
if(
|
|
||||||
$host["host"] == "boards.4chan.org" ||
|
|
||||||
$host["host"] == "boards.4channel.org"
|
|
||||||
){
|
|
||||||
|
|
||||||
$archives = [];
|
if(
|
||||||
$path = explode("/", $host["path"]);
|
count($esc) === 2 &&
|
||||||
$count = count($path);
|
$esc[0] == "www"
|
||||||
// /pol/thread/417568063/post-shitty-memes-if-you-want-to
|
){
|
||||||
|
|
||||||
|
$esc = $esc[1];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$esc = $esc[0];
|
||||||
|
}
|
||||||
|
|
||||||
if($count !== 0){
|
$esc = substr($esc, 0, 2);
|
||||||
|
|
||||||
|
$urlencode = urlencode($link);
|
||||||
|
|
||||||
|
$payload =
|
||||||
|
'<div class="url">' .
|
||||||
|
'<button class="favicon" tabindex="-1">' .
|
||||||
|
'<img src="/favicon?s=' . htmlspecialchars($host["scheme"] . "://" . $host["host"]) . '" alt="' . htmlspecialchars($esc) . '">' .
|
||||||
|
//'<img src="/404.php" alt="' . htmlspecialchars($esc) . '">' .
|
||||||
|
'</button>' .
|
||||||
|
'<div class="favicon-dropdown">';
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add archive links
|
||||||
|
*/
|
||||||
|
if(
|
||||||
|
$host["host"] == "boards.4chan.org" ||
|
||||||
|
$host["host"] == "boards.4channel.org"
|
||||||
|
){
|
||||||
|
|
||||||
$isboard = true;
|
$archives = [];
|
||||||
|
$path = explode("/", $host["path"]);
|
||||||
|
$count = count($path);
|
||||||
|
// /pol/thread/417568063/post-shitty-memes-if-you-want-to
|
||||||
|
|
||||||
switch($path[1]){
|
if($count !== 0){
|
||||||
|
|
||||||
case "con":
|
$isboard = true;
|
||||||
break;
|
|
||||||
|
|
||||||
case "q":
|
switch($path[1]){
|
||||||
$archives[] = "desuarchive.org";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "qa":
|
case "con":
|
||||||
$archives[] = "desuarchive.org";
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case "qb":
|
case "q":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "qa":
|
||||||
|
$archives[] = "desuarchive.org";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "qb":
|
||||||
|
$archives[] = "arch.b4k.co";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "trash":
|
||||||
|
$archives[] = "desuarchive.org";
|
||||||
|
break;
|
||||||
|
|
||||||
case "trash":
|
case "a":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "a":
|
case "c":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "c":
|
case "w":
|
||||||
$archives[] = "desuarchive.org";
|
break;
|
||||||
break;
|
|
||||||
|
case "m":
|
||||||
case "w":
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "m":
|
case "cgl":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
$archives[] = "warosu.org";
|
||||||
|
break;
|
||||||
case "cgl":
|
|
||||||
$archives[] = "desuarchive.org";
|
case "f":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "f":
|
case "n":
|
||||||
$archives[] = "archive.4plebs.org";
|
break;
|
||||||
break;
|
|
||||||
|
case "jp":
|
||||||
case "n":
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "jp":
|
case "vt":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vt":
|
case "v":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "v":
|
case "vg":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vg":
|
case "vm":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vm":
|
case "vmg":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vmg":
|
case "vp":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vp":
|
case "vr":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
$archives[] = "warosu.org";
|
||||||
|
break;
|
||||||
case "vr":
|
|
||||||
$archives[] = "desuarchive.org";
|
case "vrpg":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vrpg":
|
case "vst":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "arch.b4k.co";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vst":
|
case "co":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "co":
|
case "g":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
$archives[] = "arch.b4k.co";
|
||||||
|
break;
|
||||||
case "g":
|
|
||||||
$archives[] = "desuarchive.org";
|
case "tv":
|
||||||
$archives[] = "arch.b4k.co";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "tv":
|
case "k":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "k":
|
case "o":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "o":
|
case "an":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "an":
|
case "tg":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
$archives[] = "archive.4plebs.org";
|
||||||
|
break;
|
||||||
case "tg":
|
|
||||||
$archives[] = "desuarchive.org";
|
case "sp":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "sp":
|
case "xs":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "eientei.xyz";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "xs":
|
case "pw":
|
||||||
$archives[] = "eientei.xyz";
|
break;
|
||||||
break;
|
|
||||||
|
case "sci":
|
||||||
case "pw":
|
$archives[] = "warosu.org";
|
||||||
break;
|
$archives[] = "eientei.xyz";
|
||||||
|
break;
|
||||||
case "sci":
|
|
||||||
$archives[] = "warosu.org";
|
case "his":
|
||||||
$archives[] = "eientei.xyz";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "his":
|
case "int":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "int":
|
case "out":
|
||||||
$archives[] = "desuarchive.org";
|
break;
|
||||||
break;
|
|
||||||
|
case "toy":
|
||||||
case "out":
|
break;
|
||||||
break;
|
|
||||||
|
case "i":
|
||||||
case "toy":
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
$archives[] = "eientei.xyz";
|
||||||
|
break;
|
||||||
case "i":
|
|
||||||
$archives[] = "archiveofsins.com";
|
case "po":
|
||||||
$archives[] = "eientei.xyz";
|
break;
|
||||||
break;
|
|
||||||
|
case "p":
|
||||||
case "po":
|
break;
|
||||||
break;
|
|
||||||
|
case "ck":
|
||||||
case "p":
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "ck":
|
case "ic":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "ic":
|
case "wg":
|
||||||
$archives[] = "warosu.org";
|
break;
|
||||||
break;
|
|
||||||
|
case "lit":
|
||||||
case "wg":
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "lit":
|
case "mu":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "mu":
|
case "fa":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "fa":
|
case "3":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "warosu.org";
|
||||||
break;
|
$archives[] = "eientei.xyz";
|
||||||
|
break;
|
||||||
case "3":
|
|
||||||
$archives[] = "warosu.org";
|
case "gd":
|
||||||
$archives[] = "eientei.xyz";
|
break;
|
||||||
break;
|
|
||||||
|
case "diy":
|
||||||
case "gd":
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "diy":
|
case "wsg":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "wsg":
|
case "qst":
|
||||||
$archives[] = "desuarchive.org";
|
break;
|
||||||
break;
|
|
||||||
|
case "biz":
|
||||||
case "qst":
|
$archives[] = "warosu.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "biz":
|
case "trv":
|
||||||
$archives[] = "warosu.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "trv":
|
case "fit":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "fit":
|
case "x":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "x":
|
case "adv":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "adv":
|
case "lgbt":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "lgbt":
|
case "mlp":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
$archives[] = "arch.b4k.co";
|
||||||
|
break;
|
||||||
case "mlp":
|
|
||||||
$archives[] = "desuarchive.org";
|
case "news":
|
||||||
$archives[] = "arch.b4k.co";
|
break;
|
||||||
break;
|
|
||||||
|
case "wsr":
|
||||||
case "news":
|
break;
|
||||||
break;
|
|
||||||
|
case "vip":
|
||||||
case "wsr":
|
break;
|
||||||
break;
|
|
||||||
|
case "b":
|
||||||
case "vip":
|
$archives[] = "thebarchive.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "b":
|
case "r9k":
|
||||||
$archives[] = "thebarchive.com";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "r9k":
|
case "pol":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "pol":
|
case "bant":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "thebarchive.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "bant":
|
case "soc":
|
||||||
$archives[] = "thebarchive.com";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "soc":
|
case "s4s":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "s4s":
|
case "s":
|
||||||
$archives[] = "archive.4plebs.org";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "s":
|
case "hc":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hc":
|
case "hm":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hm":
|
case "h":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "h":
|
case "e":
|
||||||
$archives[] = "archiveofsins.com";
|
break;
|
||||||
break;
|
|
||||||
|
case "u":
|
||||||
case "e":
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "u":
|
case "d":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "d":
|
case "t":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "t":
|
case "hr":
|
||||||
$archives[] = "archiveofsins.com";
|
$archives[] = "archive.4plebs.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hr":
|
case "gif":
|
||||||
$archives[] = "archive.4plebs.org";
|
break;
|
||||||
break;
|
|
||||||
|
case "aco":
|
||||||
case "gif":
|
$archives[] = "desuarchive.org";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "aco":
|
case "r":
|
||||||
$archives[] = "desuarchive.org";
|
$archives[] = "archiveofsins.com";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "r":
|
default:
|
||||||
$archives[] = "archiveofsins.com";
|
$isboard = false;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
|
||||||
$isboard = false;
|
if($isboard === true){
|
||||||
break;
|
|
||||||
}
|
$archives[] = "archived.moe";
|
||||||
|
}
|
||||||
if($isboard === true){
|
|
||||||
|
$trail = "";
|
||||||
$archives[] = "archived.moe";
|
|
||||||
}
|
if(
|
||||||
|
isset($path[2]) &&
|
||||||
$trail = "";
|
isset($path[3]) &&
|
||||||
|
$path[2] == "thread"
|
||||||
if(
|
){
|
||||||
isset($path[2]) &&
|
|
||||||
isset($path[3]) &&
|
$trail .= "/" . $path[1] . "/thread/" . $path[3];
|
||||||
$path[2] == "thread"
|
}elseif($isboard){
|
||||||
){
|
|
||||||
|
$trail = "/" . $path[1] . "/";
|
||||||
$trail .= "/" . $path[1] . "/thread/" . $path[3];
|
}
|
||||||
}elseif($isboard){
|
|
||||||
|
for($i=0; $i<count($archives); $i++){
|
||||||
$trail = "/" . $path[1] . "/";
|
|
||||||
}
|
$payload .=
|
||||||
|
'<a href="https://' . $archives[$i] . $trail . '" class="list" target="_BLANK">' .
|
||||||
for($i=0; $i<count($archives); $i++){
|
'<img src="/favicon?s=https://' . $archives[$i] . '" alt="' . $archives[$i][0] . $archives[$i][1] . '">' .
|
||||||
|
$archives[$i] .
|
||||||
$payload .=
|
'</a>';
|
||||||
'<a href="https://' . $archives[$i] . $trail . '" class="list" target="_BLANK">' .
|
}
|
||||||
'<img src="/favicon?s=https://' . $archives[$i] . '" alt="' . $archives[$i][0] . $archives[$i][1] . '">' .
|
|
||||||
$archives[$i] .
|
|
||||||
'</a>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$payload .=
|
||||||
|
'<a href="https://web.archive.org/web/' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://archive.org" alt="ar">Archive.org</a>' .
|
||||||
|
'<a href="https://archive.ph/newest/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img src="/favicon?s=https://archive.is" alt="ar">Archive.is</a>' .
|
||||||
|
'<a href="https://ghostarchive.org/search?term=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://ghostarchive.org" alt="gh">Ghostarchive</a>' .
|
||||||
|
'<a href="https://arquivo.pt/wayback/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img src="/favicon?s=https://arquivo.pt" alt="ar">Arquivo.pt</a>' .
|
||||||
|
'<a href="https://www.bing.com/search?q=url%3A' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://bing.com" alt="bi">Bing cache</a>' .
|
||||||
|
'<a href="https://megalodon.jp/?url=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://megalodon.jp" alt="me">Megalodon</a>' .
|
||||||
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$payload .=
|
|
||||||
'<a href="https://web.archive.org/web/' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://archive.org" alt="ar">Archive.org</a>' .
|
|
||||||
'<a href="https://archive.ph/newest/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img src="/favicon?s=https://archive.is" alt="ar">Archive.is</a>' .
|
|
||||||
'<a href="https://ghostarchive.org/search?term=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://ghostarchive.org" alt="gh">Ghostarchive</a>' .
|
|
||||||
'<a href="https://arquivo.pt/wayback/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img src="/favicon?s=https://arquivo.pt" alt="ar">Arquivo.pt</a>' .
|
|
||||||
'<a href="https://www.bing.com/search?q=url%3A' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://bing.com" alt="bi">Bing cache</a>' .
|
|
||||||
'<a href="https://megalodon.jp/?url=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://megalodon.jp" alt="me">Megalodon</a>' .
|
|
||||||
'</div>';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Draw link
|
Draw link
|
||||||
*/
|
*/
|
||||||
@@ -862,10 +874,12 @@ class frontend{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// merge https://site together
|
// merge https://site together
|
||||||
$parts = [
|
if(isset($host["host"])){
|
||||||
$parts[0] . $parts[1] . '//' . $parts[2],
|
$parts = [
|
||||||
...array_slice($parts, 3, count($parts) - 1)
|
$parts[0] . $parts[1] . '//' . $parts[2],
|
||||||
];
|
...array_slice($parts, 3, count($parts) - 1)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$c = count($parts);
|
$c = count($parts);
|
||||||
for($i=0; $i<$c; $i++){
|
for($i=0; $i<$c; $i++){
|
||||||
@@ -1034,7 +1048,8 @@ class frontend{
|
|||||||
$filters["scraper"] = [
|
$filters["scraper"] = [
|
||||||
"display" => "Scraper",
|
"display" => "Scraper",
|
||||||
"option" => [
|
"option" => [
|
||||||
"sc" => "SoundCloud"
|
"sc" => "SoundCloud",
|
||||||
|
"swisscows" => "Swisscows (SoundCloud)"
|
||||||
//"spotify" => "Spotify"
|
//"spotify" => "Spotify"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
66
resolver.php
Normal file
66
resolver.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$resolver = new resolver();
|
||||||
|
|
||||||
|
class resolver{
|
||||||
|
|
||||||
|
public const resolvers = [
|
||||||
|
"sc"
|
||||||
|
];
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
include "data/config.php";
|
||||||
|
|
||||||
|
if(
|
||||||
|
!isset($_GET["scraper"]) ||
|
||||||
|
!is_string($_GET["scraper"]) ||
|
||||||
|
!in_array($_GET["scraper"], self::resolvers)
|
||||||
|
){
|
||||||
|
|
||||||
|
$this->do400("Missing or invalid scraper");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(
|
||||||
|
!isset($_GET["target"]) ||
|
||||||
|
!is_string($_GET["target"])
|
||||||
|
){
|
||||||
|
|
||||||
|
$this->do400("Missing or invalid target");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scraper = $_GET["scraper"];
|
||||||
|
$target = $_GET["target"];
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
include "resolver/{$scraper}.php";
|
||||||
|
$resolver = new $scraper();
|
||||||
|
$link = $resolver->resolve($target);
|
||||||
|
|
||||||
|
if(is_string($link)){
|
||||||
|
|
||||||
|
header("Location: {$link}");
|
||||||
|
}
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
$this->do404("Fuck! Failed to resolve URL: " . $error->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function do400($message){
|
||||||
|
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
http_response_code(400);
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function do404($message){
|
||||||
|
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
http_response_code(404);
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
}
|
||||||
117
resolver/sc.php
Normal file
117
resolver/sc.php
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class sc{
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
include "lib/backend.php";
|
||||||
|
$this->backend = new backend("sc");
|
||||||
|
|
||||||
|
include "lib/fuckhtml.php";
|
||||||
|
$this->fuckhtml = new fuckhtml();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get($proxy, $url, $get = []){
|
||||||
|
|
||||||
|
$curlproc = curl_init();
|
||||||
|
|
||||||
|
if($get !== []){
|
||||||
|
$get = http_build_query($get);
|
||||||
|
$url .= "?" . $get;
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
// http2 bypass
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
|
$headers =
|
||||||
|
["User-Agent: " . config::USER_AGENT,
|
||||||
|
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
|
"Accept-Encoding: gzip",
|
||||||
|
"DNT: 1",
|
||||||
|
"Sec-GPC: 1",
|
||||||
|
"Connection: keep-alive",
|
||||||
|
"Upgrade-Insecure-Requests: 1",
|
||||||
|
"Sec-Fetch-Dest: document",
|
||||||
|
"Sec-Fetch-Mode: navigate",
|
||||||
|
"Sec-Fetch-Site: none",
|
||||||
|
"Sec-Fetch-User: ?1",
|
||||||
|
"Priority: u=0, i"];
|
||||||
|
|
||||||
|
$this->backend->assign_proxy($curlproc, $proxy);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYPEER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 30);
|
||||||
|
curl_setopt($curlproc, CURLOPT_TIMEOUT, 30);
|
||||||
|
|
||||||
|
$data = curl_exec($curlproc);
|
||||||
|
|
||||||
|
if(curl_errno($curlproc)){
|
||||||
|
throw new Exception(curl_error($curlproc));
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_close($curlproc);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolve($id){
|
||||||
|
|
||||||
|
if(
|
||||||
|
!preg_match(
|
||||||
|
'/^(t|p)[0-9]+$/',
|
||||||
|
$id
|
||||||
|
)
|
||||||
|
){
|
||||||
|
|
||||||
|
throw new Exception("ID is invalid");
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = $id[0] == "t" ? "track" : "playlist";
|
||||||
|
$id = substr($id, 1);
|
||||||
|
|
||||||
|
try{
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$this->backend->get_ip(),
|
||||||
|
"https://w.soundcloud.com/player/",
|
||||||
|
[
|
||||||
|
"url" => "http://api.soundcloud.com/{$type}s/{$id}",
|
||||||
|
"show_artwork" => "true"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch song embed page");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$link =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"rel",
|
||||||
|
"canonical",
|
||||||
|
"link"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($link) === 0){
|
||||||
|
|
||||||
|
throw new Exception("Soundcloud could not resolve the song ID to an URL");
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$link[0]
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -397,7 +397,12 @@ class sc{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "track":
|
case "track":
|
||||||
if(stripos($item["monetization_model"], "TIER") === false){
|
$stream = [
|
||||||
|
"endpoint" => null,
|
||||||
|
"url" => null
|
||||||
|
];
|
||||||
|
|
||||||
|
/*if(stripos($item["monetization_model"], "TIER") === false){
|
||||||
|
|
||||||
$stream = [
|
$stream = [
|
||||||
"endpoint" => "sc",
|
"endpoint" => "sc",
|
||||||
@@ -413,7 +418,7 @@ class sc{
|
|||||||
"endpoint" => null,
|
"endpoint" => null,
|
||||||
"url" => null
|
"url" => null
|
||||||
];
|
];
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// parse track
|
// parse track
|
||||||
$out["song"][] = [
|
$out["song"][] = [
|
||||||
|
|||||||
252
scraper/swisscows.php
Normal file
252
scraper/swisscows.php
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class swisscows{
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
include "lib/backend.php";
|
||||||
|
$this->backend = new backend("swisscows");
|
||||||
|
|
||||||
|
include "lib/fuckhtml.php";
|
||||||
|
$this->fuckhtml = new fuckhtml();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getfilters($page){
|
||||||
|
|
||||||
|
return [
|
||||||
|
"type" => [
|
||||||
|
"display" => "Type",
|
||||||
|
"option" => [
|
||||||
|
"track" => "Tracks",
|
||||||
|
"playlist" => "Playlists"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get($proxy, $url, $get = [], $web_req = false){
|
||||||
|
|
||||||
|
$curlproc = curl_init();
|
||||||
|
|
||||||
|
if($get !== []){
|
||||||
|
$get = http_build_query($get);
|
||||||
|
$url .= "?" . $get;
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
|
|
||||||
|
// use http2
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
|
["User-Agent: " . config::USER_AGENT,
|
||||||
|
"Accept: */*",
|
||||||
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
|
"Accept-Encoding: gzip, deflate, br, zstd",
|
||||||
|
"Access-Control-Request-Method: GET",
|
||||||
|
"Access-Control-Request-Headers: cache-control",
|
||||||
|
"Referer: https://swisscows.com/",
|
||||||
|
"Origin: https://swisscows.com",
|
||||||
|
"DNT: 1",
|
||||||
|
"Sec-GPC: 1",
|
||||||
|
"Connection: keep-alive",
|
||||||
|
"Sec-Fetch-Dest: empty",
|
||||||
|
"Sec-Fetch-Mode: cors",
|
||||||
|
"Sec-Fetch-Site: same-site",
|
||||||
|
"Priority: u=4",
|
||||||
|
"TE: trailers"]
|
||||||
|
);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYPEER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 30);
|
||||||
|
curl_setopt($curlproc, CURLOPT_TIMEOUT, 30);
|
||||||
|
|
||||||
|
$this->backend->assign_proxy($curlproc, $proxy);
|
||||||
|
|
||||||
|
$data = curl_exec($curlproc);
|
||||||
|
|
||||||
|
if(curl_errno($curlproc)){
|
||||||
|
|
||||||
|
throw new Exception(curl_error($curlproc));
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_close($curlproc);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function music($get, $last_attempt = false){
|
||||||
|
|
||||||
|
if($get["npt"]){
|
||||||
|
|
||||||
|
[$params, $proxy] = $this->backend->get($get["npt"], "music");
|
||||||
|
$params = json_decode($params, true);
|
||||||
|
$type = $params["type"];
|
||||||
|
$search = $params["s"];
|
||||||
|
$offset = $params["offset"];
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$search = $get["s"];
|
||||||
|
if(strlen($search) === 0){
|
||||||
|
|
||||||
|
throw new Exception("Search term is empty!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = $get["type"];
|
||||||
|
$offset = 0;
|
||||||
|
$proxy = $this->backend->get_ip();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$json =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://api.swisscows.com/audio/search/{$type}s",
|
||||||
|
[
|
||||||
|
"query" => $search,
|
||||||
|
"offset" => $offset,
|
||||||
|
"itemsCount" => 20,
|
||||||
|
"region" => "en-US"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch JSON");
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = json_decode($json, true);
|
||||||
|
|
||||||
|
if($json === null){
|
||||||
|
|
||||||
|
throw new Exception("Failed to decode JSON");
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = [
|
||||||
|
"status" => "ok",
|
||||||
|
"npt" => null,
|
||||||
|
"song" => [],
|
||||||
|
"playlist" => [],
|
||||||
|
"album" => [],
|
||||||
|
"podcast" => [],
|
||||||
|
"author" => [],
|
||||||
|
"user" => []
|
||||||
|
];
|
||||||
|
|
||||||
|
if(!isset($json["items"])){
|
||||||
|
|
||||||
|
throw new Exception("Swisscows did not return an items object");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == "track"){
|
||||||
|
foreach($json["items"] as $item){
|
||||||
|
|
||||||
|
$tags = $item["tags"];
|
||||||
|
if(!empty($item["genre"])){
|
||||||
|
|
||||||
|
$tags[] = $item["genre"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$out["song"][] = [
|
||||||
|
"title" => $item["title"],
|
||||||
|
"description" => implode(", ", $tags),
|
||||||
|
"url" => "/resolver?scraper=sc&target=t{$item["id"]}",
|
||||||
|
"views" => null,
|
||||||
|
"author" => [
|
||||||
|
"name" => null,
|
||||||
|
"url" => null,
|
||||||
|
"avatar" => null
|
||||||
|
],
|
||||||
|
"thumb" => [
|
||||||
|
"ratio" => "1:1",
|
||||||
|
"url" => $item["artworkUrl"]
|
||||||
|
],
|
||||||
|
"date" => null,
|
||||||
|
"duration" => $this->convert_time($item["duration"]),
|
||||||
|
"stream" => [
|
||||||
|
"endpoint" => null,
|
||||||
|
"url" => null
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
foreach($json["items"] as $item){
|
||||||
|
|
||||||
|
$out["playlist"][] = [
|
||||||
|
"title" => $item["title"],
|
||||||
|
"description" => $this->limitstrlen($item["description"]),
|
||||||
|
"author" => [
|
||||||
|
"name" => null,
|
||||||
|
"url" => null,
|
||||||
|
"avatar" => null
|
||||||
|
],
|
||||||
|
"thumb" => [
|
||||||
|
"ratio" => "1:1",
|
||||||
|
"url" => $item["artworkUrl"]
|
||||||
|
],
|
||||||
|
"date" => null,
|
||||||
|
"duration" => $this->convert_time($item["duration"]),
|
||||||
|
"url" => "/resolver?scraper=sc&target=p{$item["id"]}",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// get NPT
|
||||||
|
//
|
||||||
|
if(
|
||||||
|
isset($json["nextOffset"]) &&
|
||||||
|
$json["nextOffset"] !== null
|
||||||
|
){
|
||||||
|
|
||||||
|
$out["npt"] =
|
||||||
|
$this->backend->store(
|
||||||
|
json_encode(
|
||||||
|
[
|
||||||
|
"type" => $type,
|
||||||
|
"s" => $search,
|
||||||
|
"offset" => $json["nextOffset"]
|
||||||
|
]
|
||||||
|
),
|
||||||
|
"music",
|
||||||
|
$proxy
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function limitstrlen($text){
|
||||||
|
|
||||||
|
return
|
||||||
|
explode(
|
||||||
|
"\n",
|
||||||
|
wordwrap(
|
||||||
|
str_replace(
|
||||||
|
["\n\r", "\r\n", "\n", "\r"],
|
||||||
|
" ",
|
||||||
|
$text
|
||||||
|
),
|
||||||
|
300,
|
||||||
|
"\n"
|
||||||
|
),
|
||||||
|
2
|
||||||
|
)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function convert_time($time){
|
||||||
|
|
||||||
|
list($hours, $minutes, $seconds) = explode(':', $time);
|
||||||
|
|
||||||
|
return
|
||||||
|
((int)$hours * 3600) +
|
||||||
|
((int)$minutes * 60) +
|
||||||
|
(float)$seconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
settings.php
14
settings.php
@@ -388,11 +388,15 @@ $settings = [
|
|||||||
[
|
[
|
||||||
"value" => "sc",
|
"value" => "sc",
|
||||||
"text" => "SoundCloud"
|
"text" => "SoundCloud"
|
||||||
]//,
|
],
|
||||||
//[
|
[
|
||||||
// "value" => "spotify",
|
"value" => "swisscows",
|
||||||
// "text" => "Spotify"
|
"text" => "Swisscows"
|
||||||
//]
|
]
|
||||||
|
/*[
|
||||||
|
"value" => "spotify",
|
||||||
|
"text" => "Spotify"
|
||||||
|
]*/
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user