mirror of
https://github.com/Ahwxorg/Binternet.git
synced 2026-03-11 08:54:37 +00:00
it finally works WOOOOOOOOOOOO
This commit is contained in:
parent
a0d145c5c0
commit
7453d7a40a
5 changed files with 62 additions and 46 deletions
20
config.php
20
config.php
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
return (object) array(
|
||||
"curl_settings" => array(
|
||||
// CURLOPT_PROXY => "ip:port",
|
||||
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
|
||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||
CURLOPT_CUSTOMREQUEST => "GET",
|
||||
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
||||
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
||||
CURLOPT_MAXREDIRS => 5,
|
||||
CURLOPT_TIMEOUT => 18,
|
||||
CURLOPT_VERBOSE => false
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
// settings basically stolen from LibreX - https://github.com/hnhx/librex
|
||||
|
|
@ -7,9 +7,8 @@ $allowed_domains = array("pinimg.com", "i.pinimg.com", "pinterest.com");
|
|||
|
||||
if (in_array(get_root_domain($url), $allowed_domains))
|
||||
{
|
||||
header("Content-Type: image/jpeg");
|
||||
header("Content-type: image/jpeg");
|
||||
echo request($url);
|
||||
}
|
||||
?>
|
||||
|
||||
// somewhat stolen from github.com/hnhx/librex
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -21,12 +21,10 @@
|
|||
{
|
||||
$config = require "config.php";
|
||||
|
||||
if (isset($_COOKIE[$frontend]) || isset($_REQUEST[$frontend]) || !empty($config->$frontend))
|
||||
if (isset($_COOKIE[$frontend]) || !empty($config->$frontend))
|
||||
{
|
||||
if (isset($_COOKIE[$frontend]))
|
||||
$frontend = $_COOKIE[$frontend];
|
||||
else if (isset($_REQUEST[$frontend]))
|
||||
$frontend = $_REQUEST[$frontend];
|
||||
else if (!empty($config->$frontend))
|
||||
$frontend = $config->$frontend;
|
||||
|
||||
|
|
@ -140,7 +138,7 @@
|
|||
|
||||
function check_for_special_search($query)
|
||||
{
|
||||
if (isset($_COOKIE["disable_special"]) || isset($_REQUEST["disable_special"]))
|
||||
if (isset($_COOKIE["disable_special"]))
|
||||
return 0;
|
||||
|
||||
$query_lower = strtolower($query);
|
||||
|
|
@ -194,13 +192,12 @@
|
|||
|
||||
function request($url)
|
||||
{
|
||||
$ch = curl_init($url);
|
||||
// curl_setopt_array($ch, $config->curl_settings);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
return $response;
|
||||
return $response;
|
||||
}
|
||||
|
||||
function human_filesize($bytes, $dec = 2)
|
||||
|
|
@ -226,13 +223,6 @@
|
|||
function print_next_page_button($text, $page, $query, $type)
|
||||
{
|
||||
echo "<form class=\"page\" action=\"search.php\" target=\"_top\" method=\"get\" autocomplete=\"off\">";
|
||||
foreach($_REQUEST as $key=>$value)
|
||||
{
|
||||
if ($key != "q" && $key != "p" && $key != "t")
|
||||
{
|
||||
echo "<input type=\"hidden\" name=\"$key\" value=\"$value\"/>";
|
||||
}
|
||||
}
|
||||
echo "<input type=\"hidden\" name=\"p\" value=\"" . $page . "\" />";
|
||||
echo "<input type=\"hidden\" name=\"q\" value=\"$query\" />";
|
||||
echo "<input type=\"hidden\" name=\"t\" value=\"$type\" />";
|
||||
|
|
@ -240,5 +230,3 @@
|
|||
echo "</form>";
|
||||
}
|
||||
?>
|
||||
|
||||
//basically completely stolen from LibreX - https://github.com/hnhx/LibreX
|
||||
|
|
|
|||
|
|
@ -25,13 +25,9 @@
|
|||
</form>
|
||||
|
||||
<?php
|
||||
//require "engines/pinterest.php";
|
||||
|
||||
$query = $_GET['q'];
|
||||
|
||||
//$imgResults = get_image_results($query);
|
||||
//print_image_results($imgResults);
|
||||
|
||||
$baseurl = "https://pinterest.com/resource/BaseSearchResource/get/?data=%7B%22options%22%3A%7B%22query%22%3A%22{}%22%7D%7D";
|
||||
|
||||
$search = function($query) use($baseurl)
|
||||
|
|
|
|||
53
search.php.bak
Normal file
53
search.php.bak
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php require "misc/header.php"; ?>
|
||||
<title>
|
||||
<?php
|
||||
$query = htmlspecialchars(trim($_REQUEST["q"]));
|
||||
echo $query;
|
||||
?> - Pinternet</title>
|
||||
</head>
|
||||
<body>
|
||||
<form class="searchContainer" method="get" autocomplete="off">
|
||||
<h1><a class="no-decoration" href="./"><span>P</span>inter<span>n</span>et</a></h1>
|
||||
<input type="text" name="q"
|
||||
<?php
|
||||
$query_encoded = urlencode($query);
|
||||
|
||||
if (1 > strlen($query) || strlen($query) > 64)
|
||||
{
|
||||
header("Location: ./");
|
||||
die();
|
||||
}
|
||||
|
||||
echo "value=\"$query\"";
|
||||
?>
|
||||
<br>
|
||||
<hr>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
$base = "https://pinterest.com/resource/BaseSearchResource/get/?data=%7B%22options%22%3A%7B%22query%22%3A%22{}%22%7D%7D";
|
||||
|
||||
$search = function($query) use($base)
|
||||
{
|
||||
$url = str_replace("{}", str_replace(" ", "%20", $query), $base);
|
||||
$json = file_get_contents($url);
|
||||
$data = json_decode($json);
|
||||
$images = array();
|
||||
foreach ($data->{"resource_response"}->{"data"}->{"results"} as $result)
|
||||
{
|
||||
$image = $result->{"images"}->{"orig"};
|
||||
$url = $image->{"url"};
|
||||
array_push($images, $url);
|
||||
}
|
||||
return $images;
|
||||
};
|
||||
|
||||
$images = $search($_REQUEST["q"]);
|
||||
echo json_encode($images);
|
||||
|
||||
foreach ($img as $imgs) {
|
||||
echo "<img src=",$img,">";
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in a new issue