first commit

This commit is contained in:
huangjx
2021-09-09 22:03:08 +08:00
commit f2a2365102
74 changed files with 33916 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace OCA\NcDownloader\Search;
require __DIR__ . "/../../vendor/autoload.php";
use OCA\NcDownloader\Search\Sites\TPB;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpClient\HttpClient;
class torrentSearch
{
public static function go($keyword)
{
$client = HttpClient::create();
$crawler = new Crawler();
$tpb = new TPB($crawler, $client);
$data = $tpb->search($keyword);
self::addAction($data);
return $data;
}
private static function addAction(&$data)
{
foreach ($data as $key => &$value) {
if (!$value) {
continue;
}
$value['actions'][] = array("name" => 'add', 'path' => '/index.php/apps/ncdownloader/new');
}
}
}