Compare commits
3 Commits
c1508af858
...
d27bdeb710
Author | SHA1 | Date | |
---|---|---|---|
d27bdeb710 | |||
![]() |
197f5dfbf3 | ||
![]() |
3075f4d47a |
@ -182,6 +182,23 @@ class imgur{
|
||||
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);
|
||||
|
||||
$posts =
|
||||
@ -197,7 +214,14 @@ class imgur{
|
||||
|
||||
$image =
|
||||
$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);
|
||||
|
||||
|
@ -1226,7 +1226,12 @@ class startpage{
|
||||
// get results
|
||||
foreach($json["render"]["presenter"]["regions"]["mainline"] as $category){
|
||||
|
||||
if($category["display_type"] == "video-youtube"){
|
||||
if(
|
||||
preg_match(
|
||||
'/^video-/i',
|
||||
$category["display_type"]
|
||||
)
|
||||
){
|
||||
|
||||
foreach($category["results"] as $video){
|
||||
|
||||
@ -1248,7 +1253,7 @@ class startpage{
|
||||
}
|
||||
|
||||
$out["video"][] = [
|
||||
"title" => $video["title"],
|
||||
"title" => str_replace(["", ""], "", $video["title"]),
|
||||
"description" => $this->limitstrlen($video["description"]),
|
||||
"author" => [
|
||||
"name" => $video["channelTitle"],
|
||||
@ -1256,7 +1261,7 @@ class startpage{
|
||||
"avatar" => null
|
||||
],
|
||||
"date" => strtotime($video["publishDate"]),
|
||||
"duration" => $this->hms2int($video["duration"]),
|
||||
"duration" => $this->hms2int($category["display_type"] == "video-youtube" ? $video["duration"] : $video["duration"] / 1000),
|
||||
"views" => (int)$video["viewCount"],
|
||||
"thumb" => $thumb,
|
||||
"url" => $video["clickUrl"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user