|
|
|
@ -20,7 +20,7 @@ class Watch extends Common { |
|
|
|
|
'userinfo' => $this->common->user, |
|
|
|
|
]; |
|
|
|
|
$res['detail'] = $this->getDetail($id); |
|
|
|
|
$res['comment'] = $this->getComment($id); |
|
|
|
|
$res = $this->getComment($id, $res); |
|
|
|
|
|
|
|
|
|
$tags = []; |
|
|
|
|
if (!is_null($res['detail']->tags)) $tags = $res['detail']->tags; |
|
|
|
@ -42,7 +42,104 @@ class Watch extends Common { |
|
|
|
|
return $this->ptapi('/api/v1/search/videos?start=0&count=6&nsfw=both&'.$tag.'sort=-publishedAt&searchTarget=local'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getComment ($id) { |
|
|
|
|
return $this->ptapi('/api/v1/videos/'.$id.'/comment-threads'); |
|
|
|
|
function getComment ($id, $res) { |
|
|
|
|
$get = null; |
|
|
|
|
|
|
|
|
|
// PeerTube |
|
|
|
|
$res['comment'] = $this->ptapi('/api/v1/videos/'.$id.'/comment-threads'); |
|
|
|
|
foreach ($res['comment']->data as $co) { |
|
|
|
|
$co->src = 'PT'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// テク諏訪 |
|
|
|
|
if ( |
|
|
|
|
null !== ($get = DB::table('vid_video')->where('kerotube', env('PEER_URI').'/w/'.$res['detail']->uuid)->first()) || |
|
|
|
|
null !== ($get = DB::table('vid_video')->where('kerotube', env('PEER_URI').'/w/'.$res['detail']->shortUUID)->first()) |
|
|
|
|
) { |
|
|
|
|
if (null !== ($ts = DB::table('blg_comments')->where('video_id', $get->vid)->orderBy('created', 'desc')->get()->toArray())) { |
|
|
|
|
foreach ($ts as $t) { |
|
|
|
|
if (!is_null($t->user_id)) { |
|
|
|
|
if (null !== ($user = DB::table('users')->where('id', $t->user_id)->first())) { |
|
|
|
|
$t->user_id = new \stdClass(); |
|
|
|
|
$t->user_id->id = $user->id; |
|
|
|
|
$t->user_id->name = $user->username; |
|
|
|
|
if (null !== ($user = DB::table('usr_profile')->where('user_id', $t->user_id->id)->first())) { |
|
|
|
|
$t->user_id->avatar = $user->avatar; |
|
|
|
|
$t->user_id->displayName = $user->display_name; |
|
|
|
|
$t->user_id->gender = $user->gender; |
|
|
|
|
$t->user_id->nameStyle = $user->name_style; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$obj = new \stdClass(); |
|
|
|
|
$acc = new \stdClass(); |
|
|
|
|
$ava = !is_null($t->user_id) && !is_null($t->user_id->avatar) ? new \stdClass() : null; |
|
|
|
|
if (!is_null($ava)) $ava->path = env('APP_URL').'/'.(!is_null($t->user_id) && !is_null($t->user_id->avatar) ? $t->user_id->avatar : 'img/noicon.jpg'); |
|
|
|
|
|
|
|
|
|
$acc->url = !is_null($t->user_id) ? '/profile/'.$t->user_id->id : ''; |
|
|
|
|
$acc->name = !is_null($t->user_id) ? $t->user_id->name : (!is_null($t->name) ? $t->name : '名無しのテクニシャン'); |
|
|
|
|
$acc->host = 'technicalsuwako.jp'; |
|
|
|
|
$acc->displayName = !is_null($t->user_id) ? $t->user_id->displayName : '名無しのテクニシャン'; |
|
|
|
|
$acc->gender = !is_null($t->user_id) ? $t->user_id->gender : null; |
|
|
|
|
$acc->user_id = $t->user_id; |
|
|
|
|
$acc->avatar = $ava; |
|
|
|
|
$acc->nameStyle = !is_null($t->user_id) ? $t->user_id->nameStyle : null; |
|
|
|
|
|
|
|
|
|
$obj->id = $t->id; |
|
|
|
|
$obj->threadId = $t->id; |
|
|
|
|
$obj->isDeleted = false; |
|
|
|
|
$obj->src = 'TS'; |
|
|
|
|
$obj->text = $t->message; |
|
|
|
|
$obj->createdAt = date('Y-m-d H:i:s', $t->created); |
|
|
|
|
$obj->updatedAt = date('Y-m-d H:i:s', $t->created); |
|
|
|
|
$obj->account = $acc; |
|
|
|
|
|
|
|
|
|
$res['comment']->data[] = $obj; |
|
|
|
|
$res['comment']->total++; |
|
|
|
|
$res['comment']->totalNotDeletedComments++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!is_null($get)) { |
|
|
|
|
// YouTube |
|
|
|
|
if (null !== ($yt = DB::table('vid_ytcomment')->where('vid', $get->vid)->first())) { |
|
|
|
|
$yt = unserialize($yt->come); |
|
|
|
|
foreach ($yt['come'] as $t) { |
|
|
|
|
$obj = new \stdClass(); |
|
|
|
|
$acc = new \stdClass(); |
|
|
|
|
$ava = !is_null($t->icon) ? new \stdClass() : null; |
|
|
|
|
if (!is_null($ava)) $ava->path = env('APP_URL').(!is_null($t->icon) ? $t->icon : 'img/noicon.jpg'); |
|
|
|
|
|
|
|
|
|
$acc->url = str_replace('www.youtube.com', 'youtube.076.ne.jp', $t->channel); |
|
|
|
|
$acc->name = $t->name; |
|
|
|
|
$acc->host = 'youtube.076.ne.jp'; |
|
|
|
|
$acc->avatar = $ava; |
|
|
|
|
$acc->displayName = $t->name; |
|
|
|
|
|
|
|
|
|
$obj->id = $t->id; |
|
|
|
|
$obj->threadId = $t->id; |
|
|
|
|
$obj->isDeleted = false; |
|
|
|
|
$obj->src = 'YT'; |
|
|
|
|
$obj->text = $t->message; |
|
|
|
|
$obj->createdAt = date('Y-m-d H:i:s', $t->createdTS); |
|
|
|
|
$obj->updatedAt = date('Y-m-d H:i:s', $t->createdTS); |
|
|
|
|
$obj->account = $acc; |
|
|
|
|
|
|
|
|
|
$res['comment']->data[] = $obj; |
|
|
|
|
$res['comment']->total++; |
|
|
|
|
$res['comment']->totalNotDeletedComments++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Odysee |
|
|
|
|
// $odysee = $get->odysee; |
|
|
|
|
|
|
|
|
|
// 作成日順番 |
|
|
|
|
usort($res['comment']->data, function ($a, $b) { return strtotime($b->createdAt) - strtotime($a->createdAt); }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $res; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|