From d61871a45eb674d7636ff66f92fef941f0880b31 Mon Sep 17 00:00:00 2001 From: ORelio Date: Wed, 31 Mar 2021 07:59:31 +0200 Subject: [PATCH] [NyaaTorrents] Allow searching by username (#2033) --- bridges/NyaaTorrentsBridge.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bridges/NyaaTorrentsBridge.php b/bridges/NyaaTorrentsBridge.php index ab00ece8..997022ae 100644 --- a/bridges/NyaaTorrentsBridge.php +++ b/bridges/NyaaTorrentsBridge.php @@ -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'),