[TwitterBridge] Add support for querying by list ID (#1834)

This commit is contained in:
Roman Remizov 2020-11-10 11:12:02 +05:00 committed by GitHub
parent a23d4bd0e6
commit b66026e241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -95,6 +95,20 @@ EOD
'required' => false, 'required' => false,
'title' => 'Specify term to search for' 'title' => 'Specify term to search for'
) )
),
'By list ID' => array(
'listid' => array(
'name' => 'List ID',
'exampleValue' => '31748',
'required' => true,
'title' => 'Insert the list id'
),
'filter' => array(
'name' => 'Filter',
'exampleValue' => '#rss-bridge',
'required' => false,
'title' => 'Specify term to search for'
)
) )
); );
@ -145,6 +159,8 @@ EOD
break; break;
case 'By list': case 'By list':
return $this->getInput('list') . ' - Twitter list by ' . $this->getInput('user'); return $this->getInput('list') . ' - Twitter list by ' . $this->getInput('user');
case 'By list ID':
return 'Twitter List #' . $this->getInput('listid');
default: return parent::getName(); default: return parent::getName();
} }
return 'Twitter ' . $specific . $this->getInput($param); return 'Twitter ' . $specific . $this->getInput($param);
@ -167,6 +183,10 @@ EOD
. urlencode($this->getInput('user')) . urlencode($this->getInput('user'))
. '/lists/' . '/lists/'
. str_replace(' ', '-', strtolower($this->getInput('list'))); . str_replace(' ', '-', strtolower($this->getInput('list')));
case 'By list ID':
return self::URI
. 'i/lists/'
. urlencode($this->getInput('listid'));
default: return parent::getURI(); default: return parent::getURI();
} }
} }
@ -188,6 +208,11 @@ EOD
. '/2/timeline/list.json?list_id=' . '/2/timeline/list.json?list_id='
. $this->getListId($this->getInput('user'), $this->getInput('list')) . $this->getListId($this->getInput('user'), $this->getInput('list'))
. '&tweet_mode=extended'; . '&tweet_mode=extended';
case 'By list ID':
return self::API_URI
. '/2/timeline/list.json?list_id='
. $this->getInput('listid')
. '&tweet_mode=extended';
default: returnServerError('Invalid query context !'); default: returnServerError('Invalid query context !');
} }
} }
@ -354,6 +379,7 @@ EOD;
switch($this->queriedContext) { switch($this->queriedContext) {
case 'By list': case 'By list':
case 'By list ID':
// Check if filter applies to list (using raw content) // Check if filter applies to list (using raw content)
if($this->getInput('filter')) { if($this->getInput('filter')) {
if(stripos($cleanedTweet, $this->getInput('filter')) === false) { if(stripos($cleanedTweet, $this->getInput('filter')) === false) {