[NyaaTorrents] Allow searching by username (#2033)

This commit is contained in:
ORelio 2021-03-31 07:59:31 +02:00 committed by GitHub
parent 0c8fabeb11
commit d61871a45e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,6 +50,11 @@ class NyaaTorrentsBridge extends BridgeAbstract {
'name' => 'Keyword',
'description' => 'Keyword(s)',
'type' => 'text'
),
'u' => array(
'name' => 'User',
'description' => 'User',
'type' => 'text'
)
)
);
@ -60,8 +65,13 @@ class NyaaTorrentsBridge extends BridgeAbstract {
public function collectData() {
// Build Search URL from user-provided parameters
$search_url = self::URI . '?s=id&o=desc&'
// Determine base URL, either home page or user page
$base_uri = self::URI;
if (!empty($this->getInput('u')))
$base_uri = $base_uri . 'user/' . urlencode($this->getInput('u'));
// Build Search URL from base URL and search criteria
$search_url = $base_uri . '?s=id&o=desc&'
. http_build_query(array(
'f' => $this->getInput('f'),
'c' => $this->getInput('c'),