aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlolcat <will@lolcat.ca>2025-08-07 17:56:39 -0400
committerlolcat <will@lolcat.ca>2025-08-07 17:56:39 -0400
commitad535a16092b765c996858c3fbcdf726df5a0502 (patch)
treef8fc67248bc1a0b7f19011aecd10025c5e35d5b0
parent7ac53c6e117f5be9461302dcd94dc6acc35d7624 (diff)
fix broken mojeek instant answer iamge
-rw-r--r--scraper/mojeek.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/scraper/mojeek.php b/scraper/mojeek.php
index 7c19ce6..2939be5 100644
--- a/scraper/mojeek.php
+++ b/scraper/mojeek.php
@@ -692,17 +692,18 @@ class mojeek{
preg_match(
'/\/image\?img=([^&]+)/i',
$thumb[0]["attributes"]["src"],
- $thumb
+ $matches
);
- if(count($thumb) === 2){
+ if(count($matches) === 2){
+ // for some reason, if we dont get the image from mojeek
+ // it sometimes fail to fetch the right image URL
$answer["thumb"] =
- urldecode(
- $this->fuckhtml
- ->getTextContent(
- $thumb[1]
- )
+ "https://mojeek.com" .
+ $this->fuckhtml
+ ->getTextContent(
+ $thumb[0]["attributes"]["src"]
);
}
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage