36 行
989 B
PHP
36 行
989 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Peertube;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Peertube\Common;
|
|
// use Illuminate\Support\Facades\Log;
|
|
|
|
class Channel extends Common {
|
|
private $common;
|
|
private $count;
|
|
|
|
public function __construct () {
|
|
$this->common = new Common;
|
|
$this->count = 25;
|
|
}
|
|
|
|
public function index ($id, $cat='videos', $page=0) {
|
|
$res = [];
|
|
$res['page'] = 'channel';
|
|
$res['cat'] = $cat;
|
|
$res['paginate'] = $page;
|
|
$res['channel'] = $this->getChannel($id);
|
|
$res['video'] = $this->getVideo($id, ($page*$this->count), $this->count);
|
|
return view('pages.peertube.c', ['res' => $res]);
|
|
}
|
|
|
|
function getChannel ($id) {
|
|
return $this->ptapi_get('/api/v1/video-channels/'.$id);
|
|
}
|
|
|
|
function getVideo ($id, $start, $count) {
|
|
return $this->ptapi_get('/api/v1/video-channels/'.$id.'/videos?start='.$start.'&count='.$count.'&sort=-publishedAt&skipCount=false&nsfw=both');
|
|
}
|
|
}
|