From bca265aea67ec62499aaa113a6490ce9ec7fe730 Mon Sep 17 00:00:00 2001 From: lolcat Date: Sat, 22 Jul 2023 14:41:14 -0400 Subject: still missing things on google scraper --- images.php | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 images.php (limited to 'images.php') diff --git a/images.php b/images.php new file mode 100644 index 0000000..67a50e8 --- /dev/null +++ b/images.php @@ -0,0 +1,99 @@ +getscraperfilters("images"); + +$get = $frontend->parsegetfilters($_GET, $filters); + +$frontend->loadheader( + $get, + $filters, + "images" +); + +$payload = [ + "images" => "", + "nextpage" => "" +]; + +try{ + $results = $scraper->image($get); + +}catch(Exception $error){ + + echo + $frontend->drawerror( + "Shit", + 'This scraper returned an error:' . + '
' . htmlspecialchars($error->getMessage()) . '
' . + 'Things you can try:' . + '
' . + 'If the error persists, please contact the administrator.' + ); + die(); +} + +if(count($results["image"]) === 0){ + + $payload["images"] = + '
' . + "

Nobody here but us chickens!

" . + 'Have you tried:' . + '' . + '
'; +} + +foreach($results["image"] as $image){ + + $domain = htmlspecialchars(parse_url($image["url"], PHP_URL_HOST)); + + $c = count($image["source"]) - 1; + + if( + preg_match( + '/^data:/', + $image["source"][$c]["url"] + ) + ){ + + $src = htmlspecialchars($image["source"][$c]["url"]); + }else{ + + $src = "/proxy?i=" . urlencode($image["source"][$c]["url"]) . "&s=thumb"; + } + + $payload["images"] .= + '
' . + '' . + '
'; +} + +if($results["npt"] !== null){ + + $payload["nextpage"] = + 'Next page >'; +} + +echo $frontend->load("images.html", $payload); -- cgit v1.2.3