mirror of
https://git.bakhai.co.in/FbIN/4Get.git
synced 2025-11-05 04:21:31 +05:30
parent
082d05d2f1
commit
45e4047c32
1 changed files with 26 additions and 2 deletions
|
|
@ -182,6 +182,23 @@ class imgur{
|
||||||
throw new Exception("Failed to fetch HTML");
|
throw new Exception("Failed to fetch HTML");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$json = json_decode($html, true);
|
||||||
|
|
||||||
|
if($json){
|
||||||
|
|
||||||
|
// {"data":{"error":"Imgur is temporarily over capacity. Please try again later."},"success":false,"status":403}
|
||||||
|
|
||||||
|
if(isset($json["data"]["error"])){
|
||||||
|
|
||||||
|
if(stripos($json["data"]["error"], "capacity")){
|
||||||
|
|
||||||
|
throw new Exception("Imgur IP blocked this 4get instance or request proxy. Try again");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Imgur returned an unknown error (IP ban?)");
|
||||||
|
}
|
||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
$posts =
|
$posts =
|
||||||
|
|
@ -197,7 +214,14 @@ class imgur{
|
||||||
|
|
||||||
$image =
|
$image =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByTagName("img")[0];
|
->getElementsByTagName("img");
|
||||||
|
|
||||||
|
if(count($image) === 0){
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$image = $image[0];
|
||||||
|
|
||||||
$image_url = "https:" . substr($this->fuckhtml->getTextContent($image["attributes"]["src"]), 0, -5);
|
$image_url = "https:" . substr($this->fuckhtml->getTextContent($image["attributes"]["src"]), 0, -5);
|
||||||
|
|
||||||
|
|
@ -255,4 +279,4 @@ class imgur{
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue