mirror of
https://github.com/hnhx/librex.git
synced 2025-04-29 14:09:27 -04:00
Redirect to random instance if google is ratelimiting
This commit is contained in:
parent
b8817a6e28
commit
7559bc8101
1 changed files with 6 additions and 0 deletions
|
@ -114,6 +114,12 @@
|
|||
}
|
||||
|
||||
$xpath = get_xpath(curl_multi_getcontent($google_ch));
|
||||
if (curl_getinfo($google_ch)['http_code'] == '302') {
|
||||
$instances_json = json_decode(file_get_contents("instances.json"), true);
|
||||
$instances = array_map(fn($n) => $n['clearnet'], array_filter($instances_json['instances'], fn($n) => !is_null($n['clearnet'])));
|
||||
header("Location: " . $instances[array_rand($instances)] . "search.php?q=$query");
|
||||
die();
|
||||
}
|
||||
|
||||
foreach($xpath->query("//div[@id='search']//div[contains(@class, 'g')]") as $result)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue