lxst-one / video-streaming-services-api
流行视频流媒体服务的API包
0.0.1
2023-08-23 15:51 UTC
Requires
- php: ^8.1
- ext-curl: *
Requires (Dev)
- phpunit/phpunit: ^10
This package is auto-updated.
Last update: 2024-09-23 18:21:36 UTC
README
流行视频流媒体服务的非官方API客户端包。目前支持
- Voe.sx
- Upstream.to
- Vidoza.net
- Doodstream.co
- Streamhub.to
安装
所需的PHP版本 >= 8.1
目前没有计划支持更低版本,您可以分叉此仓库并重新编写。
composer require lxst-one/video-streaming-services-api
快速入门
每个服务实现的所有方法如下所示。
创建服务实例
use \LxstOne\VSS\src\VideoStreamingService; $voe = VideoStreamingService::voe('api-key', 'v1'); $upstream = VideoStreamingService::upstream('api-key', 'v1'); $vidoza = VideoStreamingService::vidoza('api-key', 'v1'); $doodstream = VideoStreamingService::doodstream('api-key', 'v1'); $streamhub = VideoStreamingService::streamhub('api-key', 'v1');
第一个参数是您的API密钥(每个实例可能不同),第二个是可选的,用于指定要使用的API版本(默认使用最新版本)
$result = $voe->getAccountInfo();
返回结果始终是一个包含值的数组
- 状态(响应代码)
- 头部(打包成数组的头部,例如:['user-agent' => 'some-agent'])
- 数据(来自服务器的原始数据字符串)
服务
API文档
- Voe.sx - https://voe.sx/api-1-reference-index
- Upstream.to - https://upstream.to/api.html
- Vidoza.net - https://vidoza.net/api
- Doodstream.co - https://doodstream.co/api-docs
- Streamhub.to - https://streamhub.to/api.html
Voe.sx实现的方法
//============================== //| API V1 //============================== public interface voeV1 { function setApiKey(string $apiKey): void; //Set API key for object function getAccountInfo(): array; //Provides some general information about the account. Cache: 5min function getAccountStats(): array; //Statistics for the last 32 days. function getUploadServer(): array; //Get a suitable upload server. function uploadToServer(string $deliveryNodeUrl, string $filePath): array; //Upload file to delivery node function uploadUrl(string $url): array; //Add url to remote upload queue function cloneFile(string $fileCode, int $folderId = 0): array; //Clone existing file code, PROVIDED THE FILE OWNER HAS ALLOWED CLONING! function getFilesInfo(string[]|string $fileCodes): array; //Information about file(s) / mass check. Max 500 function listFiles(int $pageNumber = 1, int $perPage = 20, int $folderId = 0, string $createdAfter = null, string $fileName = null): array; //List files in folder function renameFile(string $fileCode, string $newTitle): array; //Rename file title function moveFiles(string[]|string $fileCodes, int $folderId): array; //Move file(s) to folder function deleteFiles(string[]|string $deleteCodes): array; //Delete file(s) function getFolderFiles(int $folderCode): array; //List folder files function createFolder(string $folderName, int $parentFolderId = 0): array; //Create new folder function renameFolder(int $folderId, string $folderName): array; //Rename folder function listDeletedFiles(int $numberOfLastFiles = null): array; //List deleted files function listDeletedDMCAFiles(int $numberOfLastFiles = null, bool $pending = false): array; //List deleted dmca files }
Upstream.to实现的方法
//============================== //| API V1 //============================== public interface upstreamV1 { function setApiKey(string $apiKey): void; //Set API key for object function getAccountInfo(): array; //Provides some general information about the account. function getAccountStats(int $lastDays = 7): array; //Statistics for the last x days. function getUploadServer(): array; //Get a suitable upload server. function uploadToServer(string $uploadServerUrl, string $filePath, string $fileName = null, string $fileDescription = null, string $fileSnapshotPath = null, int $folderId = null, int $categoryId = null, string $tagsString = null, bool $filePublic = null, bool $fileAdult = null, bool $htmlRedirect = null): array; //Upload file to delivery node function uploadUrl(string $url, int $folderId = null, int $categoryId = null, bool $filePublic = null, bool $fileAdult = null, string $tagsString = null): array; //Add url to remote upload queue function cloneFile(string $fileCode, string $fileName = null): array; //Clone existing file code function getFilesInfo(string[]|string $fileCodes): array; //Information about file(s) function editFiles(string[]|string $fileCodes, string $fileTitle = null, string $fileDescription = null, int $categoryId = null, int $folderId = null, bool $filePublic = null, bool $fileAdult = null, string $tagsString = null): array; //Edit file(s) function listFiles(int $pageNumber = null, int $perPage = null, int $folderId = null, string $createdAfter = null, string $fileName = null, bool $filePublic = null, bool $fileAdult = null): array; //List uploaded files function listFolder(int $folderId = null, bool $showFiles = null): array; //List folders/files in folder function createFolder(string $folderName, string $folderDescription = '', int $parentFolderId = null): array; //Create new folder function editFolder(int $folderId, string $folderName = null, int $parentFolderId = null, string $folderDescription = null): array; //Update folder details function listDeletedFiles(int $lastHours = null): array; //Get last deleted files list function listDeletedDMCAFiles(int $lastHours = null): array; //Get files scheduled for DMCA delete function getEncodingQueue(string $fileCode = null): array; //Get current encoding queue }
Vidoza.net实现的方法
//============================== //| API V1 //============================== public interface vidozaV1 { function setApiKey(string $apiKey): void; //Set API key for object function getUploadServer(): array; //Get a suitable upload server. function uploadToServer(string $uploadServerUrl, string $sessionId, string $filePath, string $fileTitle = null, int $folderId = null, VideoCategory $category = null): array; //Upload file to delivery node function uploadUrl(string $url, int $folderId, VideoCategory $category): array; //Add url to remote upload queue. function listUrlUploadQueue(): array; //List url upload tasks in queue function removeUrlUploadTask(int $taskId): array; //Destroy exists task from queue function getFilesInfo(string|string[] $filesCodes): array; //Get info about files function listFolders(int $folderId = null): array; //List folder(s) function renameFolder(int $folderId, string $folderName): array; //Rename folder function createFolder(string $folderName, int $folderParentId = null): array; //Create new folder function listFiles(string $fileName = null, string $fileNameSEO = null, string $title = null, int $folderId = null, VideoCategory $category = null, int $downloadsFrom = null, int $viewsPaidFrom = null, int $downloadsTo = null, int $viewsPaidTo = null, SortingColumn $sortColumn = null, SortingDirection $sortDirection = null): array; //List files by filters function editFile(string $fileCode, string $fileName, string $fileNameSEO, string $title, string $folderId): array; //Edit file function listSrtForFile(string $fileCode): array; //Shows the list srt of your file function uploadSrtForFile(string $fileCode, VideoLang $lang, string $srtPath): array; //Upload srt for file function uploadSrtUrlForFile(string $fileCode, VideoLang $lang, string $srtUrl): array; //Upload srt (from url) for file function removeSrtForFile(string $fileCode, VideoLang $lang, VideoLangExtension $extension): array; //Destroy selected srt lang from you file function listFileAbuses(): array; //List your abuses files }
Doodstream.co实现的方法
//============================== //| API V1 //============================== public interface doodstreamV1 { function setApiKey(string $apiKey): void; //Set API key for object function getAccountInfo(): array; //Get basic info of your account function getAccountReports(int $lastDays = 7, string $fromDate = null, string $toDate = null): array; //Get reports of your account (default last 7 days) function listDMCAReports(int $perPage = null, int $page = null): array; //Get DMCA reported files list (500 results per page) function getUploadServer(): array; //Get a suitable upload server. function uploadToServer(string $uploadServerUrl, string $filePath): array; //Upload file to server function cloneFile(string $fileCode, int $folderId = null): array; //Copy / Clone yours or other's file function uploadUrl(string $url, int $folderId = null, string $title = null): array; //Upload files using direct links function listUrlUploadQueue(): array; //Remote Upload List & Status function getUrlUploadStatus(string $fileCode): array; //Remote Upload Status function getUrlUploadSlots(): array; //Get total & used remote upload slots function editUrlUploads(bool $restartErrors = null, bool $clearErrors = null, bool $clearAll = null, bool $deleteUrlCode = null): array; //Perform various actions on remote uploads function createFolder(string $name, int $parentFolderId = null): array; //Create a folder function renameFolder(int $folderId, string $newName): array; //Rename folder function listFiles(int $page = null, int $perPage = null, int $folderId = null): array; //List all files function getFileStatus(string $fileCode): array; //Check status of your file function getFileInfo(string $fileCode): array; //Get file info function getFileImage(string $fileCode): array; //Get file splash, single or thumbnail image function renameFile(string $fileCode, string $newName): array; //Rename your file function searchFile(string $searchTerm): array; //Search your files }
Streamhub.to实现的方法
//============================== //| API V1 //============================== public interface streamhubV1 { function setApiKey(string $apiKey): void; //Set API key for object function getAccountInfo(): array; //Provides some general information about the account. function getAccountStats(int $lastDays = 7): array; //Statistics for the last x days. function getUploadServer(): array; //Get a suitable upload server. function uploadToServer(string $uploadServerUrl, string $filePath, string $fileName = null, string $fileDescription = null, string $fileSnapshotPath = null, int $folderId = null, int $categoryId = null, string $tagsString = null, bool $filePublic = null, bool $fileAdult = null, bool $htmlRedirect = null): array; //Upload file to delivery node function uploadUrl(string $url, int $folderId = null, int $categoryId = null, bool $filePublic = null, bool $fileAdult = null, string $tagsString = null): array; //Add url to remote upload queue function cloneFile(string $fileCode, string $fileName = null): array; //Clone existing file code function getFilesInfo(string[]|string $fileCodes): array; //Information about file(s) function editFiles(string[]|string $fileCodes, string $fileTitle = null, string $fileDescription = null, int $categoryId = null, int $folderId = null, bool $filePublic = null, bool $fileAdult = null, string $tagsString = null): array; //Edit file(s) function listFiles(int $pageNumber = null, int $perPage = null, int $folderId = null, string $createdAfter = null, string $fileName = null, bool $filePublic = null, bool $fileAdult = null): array; //List uploaded files function listFolder(int $folderId = null, bool $showFiles = null): array; //List folders/files in folder function createFolder(string $folderName, string $folderDescription = '', int $parentFolderId = null): array; //Create new folder function editFolder(int $folderId, string $folderName = null, int $parentFolderId = null, string $folderDescription = null): array; //Update folder details function listDeletedFiles(int $lastHours = null): array; //Get last deleted files list function listDeletedDMCAFiles(int $lastHours = null): array; //Get files scheduled for DMCA delete function getEncodingQueue(string $fileCode = null): array; //Get current encoding queue function getFileDirectLink(string $fileCode, VideoQuality $videoQuality = null, bool $hls = null) //Get file direct links }
测试
配置
使用正确的值填充phpunit.xml中的所有环境变量。测试服务中的一些文件/文件夹在运行测试后可能需要手动删除。
运行所有测试
在主项目文件夹中
php ./vendor/bin/phpunit --configuration phpunit.xml tests/unit