Skip to content

Commit

Permalink
[NyaaTorrents] Allow searching by username (#2033)
Browse files Browse the repository at this point in the history
  • Loading branch information
ORelio authored Mar 31, 2021
1 parent 0c8fabe commit d61871a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bridges/NyaaTorrentsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class NyaaTorrentsBridge extends BridgeAbstract {
'name' => 'Keyword',
'description' => 'Keyword(s)',
'type' => 'text'
),
'u' => array(
'name' => 'User',
'description' => 'User',
'type' => 'text'
)
)
);
Expand All @@ -60,8 +65,13 @@ public function getIcon() {

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'),
Expand Down

0 comments on commit d61871a

Please sign in to comment.