demorfi/synox-web-api

API SynoX Web

v1.3.0 2024-03-11 20:18 UTC

This package is auto-updated.

Last update: 2024-09-14 00:18:53 UTC


README

SynoX Web 的 API 接口实现 SynoX Web

Composer 安装

composer require demorfi/synox-web-api

基本用法

$api = new \SynoxWebApi\Api('https://synox-web.domain/api/');

搜索用法

$search = $api->search();
$search->makeFilters()->addCategory('video')->addPackage('tpb'); // optional make filters
$profile = null; // optional profile name 
foreach ($search->create('Silent Hill', $profile)->run() as $item) {
    printf("Title: %s; Size: %s\n", $item->getTitle(), $item->getWeight());
    // download only this torrent file
    if (stripos($item->getTitle(), 'Silent Hill 2') !== false) {
        // $item->getFetchId(); fetched id for download
        file_put_contents('file.torrent', $item->fetch()->download());
        return;
    }
}

下载用法

$fetched = $api->content()->fetch('tpb', 'fetch id');
//$fetched->downloadUrn(); only URN path to torrent file
file_put_contents('file.torrent', $fetched->download());

更改包状态

$api->packages()->changeState('tpb', true); // enable this package

报告问题

如果您在应用程序中遇到任何问题,请在 GitHub 上提交问题。

许可协议

SynoX Web 在 MIT 许可协议 下授权。