aboutsummaryrefslogtreecommitdiffstats
path: root/scraper/mojeek.php
diff options
context:
space:
mode:
Diffstat (limited to 'scraper/mojeek.php')
-rw-r--r--scraper/mojeek.php24
1 files changed, 18 insertions, 6 deletions
diff --git a/scraper/mojeek.php b/scraper/mojeek.php
index f123b69..dc4cf03 100644
--- a/scraper/mojeek.php
+++ b/scraper/mojeek.php
@@ -376,7 +376,7 @@ class mojeek{
$headers = [
"User-Agent: " . config::USER_AGENT,
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
- "Accept-Language: en-US,en;q=0.5",
+ "Accept-Language: en-US,en;q=0.9",
"Accept-Encoding: gzip",
"DNT: 1",
"Connection: keep-alive",
@@ -447,7 +447,7 @@ class mojeek{
$proxy = $this->backend->get_ip();
$lang = $get["lang"];
$country = $get["country"];
- $region = $get["region"];
+ //$region = $get["region"];
$domain = $get["domain"];
$focus = $get["focus"];
@@ -479,11 +479,11 @@ class mojeek{
$params["lb"] = $lang;
}
-
+ /*
if($region != "any"){
$params["reg"] = $region;
- }
+ }*/
if($domain != "1"){
@@ -508,6 +508,8 @@ class mojeek{
throw new Exception("Mojeek returned an empty page (probably a homepage redirect)");
}
+ $this->fuckhtml->load($html);
+
$out = [
"status" => "ok",
"spelling" => [
@@ -524,8 +526,6 @@ class mojeek{
"related" => []
];
- $this->fuckhtml->load($html);
-
$this->detect_block();
$results =
@@ -1173,6 +1173,18 @@ class mojeek{
private function detect_block(){
+ $captcha =
+ $this->fuckhtml
+ ->getElementsByClassName(
+ "captcha-box",
+ "div"
+ );
+
+ if(count($captcha) !== 0){
+
+ throw new Exception("Mojeek returned a captcha");
+ }
+
$title =
$this->fuckhtml
->getElementsByTagName(
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage