mirror of
https://github.com/openvk/openvk
synced 2025-07-07 08:19:49 +03:00
Compare commits
No commits in common. "06b77ebad81589ed7c7f61b40be7611aab8dfc69" and "700dcc121dac2150537ee80e7827804cd9c1fa3c" have entirely different histories.
06b77ebad8
...
700dcc121d
2 changed files with 0 additions and 172 deletions
|
@ -1,79 +0,0 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\VKAPI\Handlers;
|
||||
use openvk\Web\Models\Entities\User;
|
||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||
use openvk\Web\Models\Entities\Club;
|
||||
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
||||
use openvk\Web\Models\Entities\Video as VideoEntity;
|
||||
use openvk\Web\Models\Repositories\Videos as VideosRepo;
|
||||
use openvk\Web\Models\Entities\Comment;
|
||||
use openvk\Web\Models\Repositories\Comments as CommentsRepo;
|
||||
|
||||
final class Video extends VKAPIRequestHandler
|
||||
{
|
||||
function get(string $videos, int $offset = 0, int $count = 30, int $extended = 0): object
|
||||
{
|
||||
$this->requireUser();
|
||||
|
||||
$vids = explode(',', $videos);
|
||||
|
||||
foreach($vids as $vid)
|
||||
{
|
||||
$id = explode("_", $vid);
|
||||
|
||||
$items = [];
|
||||
|
||||
$video = (new VideosRepo)->getByOwnerAndVID(intval($id[0]), intval($id[1]));
|
||||
if($video) {
|
||||
$items[] = [
|
||||
"type" => "video",
|
||||
"video" => [
|
||||
"can_comment" => 1,
|
||||
"can_like" => 0, // we don't h-have wikes in videos
|
||||
"can_repost" => 0,
|
||||
"can_subscribe" => 1,
|
||||
"can_add_to_faves" => 0,
|
||||
"can_add" => 0,
|
||||
"comments" => $video->getCommentsCount(),
|
||||
"date" => $video->getPublicationTime()->timestamp(),
|
||||
"description" => $video->getDescription(),
|
||||
"duration" => 0, // я хуй знает как получить длину видео
|
||||
"image" => [
|
||||
[
|
||||
"url" => $video->getThumbnailURL(),
|
||||
"width" => 320,
|
||||
"height" => 240,
|
||||
"with_padding" => 1
|
||||
]
|
||||
],
|
||||
"width" => 640,
|
||||
"height" => 480,
|
||||
"id" => $video->getVirtualId(),
|
||||
"owner_id" => $video->getOwner()->getId(),
|
||||
"user_id" => $video->getOwner()->getId(),
|
||||
"title" => $video->getName(),
|
||||
"is_favorite" => false,
|
||||
"player" => $video->getURL(),
|
||||
"added" => 0,
|
||||
"repeat" => 0,
|
||||
"type" => "video",
|
||||
"views" => 0,
|
||||
"likes" => [
|
||||
"count" => 0,
|
||||
"user_likes" => 0
|
||||
],
|
||||
"reposts" => [
|
||||
"count" => 0,
|
||||
"user_reposted" => 0
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return (object) [
|
||||
"count" => count($items),
|
||||
"items" => $items
|
||||
];
|
||||
}
|
||||
}
|
|
@ -48,41 +48,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
$attachments[] = $this->getApiPhoto($attachment);
|
||||
} else if($attachment instanceof \openvk\Web\Models\Entities\Poll) {
|
||||
$attachments[] = $this->getApiPoll($attachment, $this->getUser());
|
||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Video) {
|
||||
$video = [
|
||||
"type" => "video",
|
||||
"video" => [
|
||||
"can_comment" => 1,
|
||||
"can_like" => 0, // we don't h-have wikes in videos
|
||||
"can_repost" => 0,
|
||||
"can_subscribe" => 1,
|
||||
"can_add_to_faves" => 0,
|
||||
"can_add" => 0,
|
||||
"comments" => $attachment->getCommentsCount(),
|
||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||
"description" => $attachment->getDescription(),
|
||||
"duration" => 0, // я хуй знает как получить длину видео
|
||||
"image" => [
|
||||
[
|
||||
"url" => $attachment->getThumbnailURL(),
|
||||
"width" => 320,
|
||||
"height" => 240,
|
||||
"with_padding" => 1
|
||||
]
|
||||
],
|
||||
"width" => 640,
|
||||
"height" => 480,
|
||||
"id" => $attachment->getVirtualId(),
|
||||
"owner_id" => $attachment->getOwner()->getId(),
|
||||
"user_id" => $attachment->getOwner()->getId(),
|
||||
"title" => $attachment->getName(),
|
||||
"is_favorite" => false,
|
||||
"repeat" => 0,
|
||||
"type" => "video",
|
||||
"views" => 0, // у нас просмотров нет)
|
||||
]
|
||||
];
|
||||
$attachments[] = $video;
|
||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
||||
$repostAttachments = [];
|
||||
|
||||
|
@ -251,41 +216,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
$attachments[] = $this->getApiPhoto($attachment);
|
||||
} else if($attachment instanceof \openvk\Web\Models\Entities\Poll) {
|
||||
$attachments[] = $this->getApiPoll($attachment, $user);
|
||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Video) {
|
||||
$video = [
|
||||
"type" => "video",
|
||||
"video" => [
|
||||
"can_comment" => 1,
|
||||
"can_like" => 0, // we don't h-have wikes in videos
|
||||
"can_repost" => 0,
|
||||
"can_subscribe" => 1,
|
||||
"can_add_to_faves" => 0,
|
||||
"can_add" => 0,
|
||||
"comments" => $attachment->getCommentsCount(),
|
||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||
"description" => $attachment->getDescription(),
|
||||
"duration" => 0, // я хуй знает как получить длину видео
|
||||
"image" => [
|
||||
[
|
||||
"url" => $attachment->getThumbnailURL(),
|
||||
"width" => 320,
|
||||
"height" => 240,
|
||||
"with_padding" => 1
|
||||
]
|
||||
],
|
||||
"width" => 640,
|
||||
"height" => 480,
|
||||
"id" => $attachment->getVirtualId(),
|
||||
"owner_id" => $attachment->getOwner()->getId(),
|
||||
"user_id" => $attachment->getOwner()->getId(),
|
||||
"title" => $attachment->getName(),
|
||||
"is_favorite" => false,
|
||||
"repeat" => 0,
|
||||
"type" => "video",
|
||||
"views" => 0, // у нас просмотров нет)
|
||||
]
|
||||
];
|
||||
$attachments[] = $video;
|
||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
||||
$repostAttachments = [];
|
||||
|
||||
|
@ -560,14 +490,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
if($owner instanceof Club)
|
||||
$oid *= -1;
|
||||
|
||||
$attachments = [];
|
||||
|
||||
foreach($comment->getChildren() as $attachment) {
|
||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||
$attachments[] = $this->getApiPhoto($attachment);
|
||||
}
|
||||
}
|
||||
|
||||
$item = [
|
||||
"id" => $comment->getId(),
|
||||
"from_id" => $oid,
|
||||
|
@ -576,7 +498,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
"post_id" => $post->getVirtualId(),
|
||||
"owner_id" => $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(),
|
||||
"parents_stack" => [],
|
||||
"attachments" => $attachments,
|
||||
"thread" => [
|
||||
"count" => 0,
|
||||
"items" => [],
|
||||
|
@ -597,9 +518,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
$items[] = $item;
|
||||
if($extended == true)
|
||||
$profiles[] = $comment->getOwner()->getId();
|
||||
|
||||
$attachments = null;
|
||||
// Reset $attachments to not duplicate prikols
|
||||
}
|
||||
|
||||
$response = [
|
||||
|
@ -626,14 +544,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
|
||||
$profiles = [];
|
||||
|
||||
$attachments = [];
|
||||
|
||||
foreach($comment->getChildren() as $attachment) {
|
||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||
$attachments[] = $this->getApiPhoto($attachment);
|
||||
}
|
||||
}
|
||||
|
||||
$item = [
|
||||
"id" => $comment->getId(),
|
||||
"from_id" => $comment->getOwner()->getId(),
|
||||
|
@ -642,7 +552,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
"post_id" => $comment->getTarget()->getVirtualId(),
|
||||
"owner_id" => $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(),
|
||||
"parents_stack" => [],
|
||||
"attachments" => $attachments,
|
||||
"likes" => [
|
||||
"can_like" => 1,
|
||||
"count" => $comment->getLikesCount(),
|
||||
|
@ -673,8 +582,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
$response['profiles'] = (!empty($profiles) ? (new Users)->get(implode(',', $profiles), $fields) : []);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue