Synced
fixed bing images failing to load, added flickr(ff8b1addf7) fixed bing images failing to load, added flickr (ff8b1addf7) // (077692db49// (ff8b1addf7/scraper/qwant.php// (566680fe36) // (8d07e72dfe) // (4b85841a3e)
This commit is contained in:
parent
78a6af66cc
commit
5ff2b87c2e
6 changed files with 561 additions and 36 deletions
58
proxy.php
58
proxy.php
|
|
@ -34,36 +34,60 @@ try{
|
|||
)
|
||||
){
|
||||
|
||||
if(
|
||||
!isset($image["query"]) ||
|
||||
!isset($image["path"]) ||
|
||||
$image["path"] != "/th"
|
||||
){
|
||||
if(!isset($image["path"])){
|
||||
|
||||
header("X-Error: Invalid bing image path");
|
||||
header("X-Error: Missing bing image path");
|
||||
$proxy->do404();
|
||||
die();
|
||||
}
|
||||
|
||||
parse_str($image["query"], $str);
|
||||
|
||||
if(!isset($str["id"])){
|
||||
//
|
||||
// get image ID
|
||||
// formations:
|
||||
// https://tse2.mm.bing.net/th/id/OIP.3yLBkUPn8EXA1wlhWP2BHwHaE3
|
||||
// https://tse2.mm.bing.net/th?id=OIP.3yLBkUPn8EXA1wlhWP2BHwHaE3
|
||||
//
|
||||
$id = null;
|
||||
if(isset($image["query"])){
|
||||
|
||||
header("X-Error: Missing bing ID");
|
||||
parse_str($image["query"], $str);
|
||||
|
||||
if(isset($str["id"])){
|
||||
|
||||
$id = $str["id"];
|
||||
}
|
||||
}
|
||||
|
||||
if($id === null){
|
||||
|
||||
$id = explode("/th/id/", $image["path"], 2);
|
||||
|
||||
if(count($id) !== 2){
|
||||
|
||||
// malformed
|
||||
return $url;
|
||||
}
|
||||
|
||||
$id = $id[1];
|
||||
}
|
||||
|
||||
if(is_array($id)){
|
||||
|
||||
header("X-Error: Missing bing id parameter");
|
||||
$proxy->do404();
|
||||
die();
|
||||
}
|
||||
|
||||
switch($_GET["s"]){
|
||||
|
||||
case "portrait": $req = "&w=50&h=90&p=0&qlt=90"; break;
|
||||
case "landscape": $req = "&w=160&h=90&p=0&qlt=90"; break;
|
||||
case "square": $req = "&w=90&h=90&p=0&qlt=90"; break;
|
||||
case "thumb": $req = "&w=236&h=180&p=0&qlt=90"; break;
|
||||
case "cover": $req = "&w=207&h=270&p=0&qlt=90"; break;
|
||||
case "portrait": $req = "?w=50&h=90&p=0&qlt=90"; break;
|
||||
case "landscape": $req = "?w=160&h=90&p=0&qlt=90"; break;
|
||||
case "square": $req = "?w=90&h=90&p=0&qlt=90"; break;
|
||||
case "thumb": $req = "?w=236&h=180&p=0&qlt=90"; break;
|
||||
case "cover": $req = "?w=207&h=270&p=0&qlt=90"; break;
|
||||
}
|
||||
|
||||
$proxy->stream_linear_image("https://" . $image["host"] . "/th?id=" . urlencode($str["id"]) . $req, "https://www.bing.com");
|
||||
$proxy->stream_linear_image("https://" . $image["host"] . "/th/id/" . urlencode($id) . $req, "https://www.bing.com");
|
||||
die();
|
||||
}
|
||||
|
||||
|
|
@ -153,4 +177,4 @@ try{
|
|||
header("X-Error: " . $error->getMessage());
|
||||
$proxy->do404();
|
||||
die();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue