Skip to content

Commit

Permalink
[TwitterBridge] Add support for querying by list ID (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
rremizov authored Nov 10, 2020
1 parent a23d4bd commit b66026e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bridges/TwitterBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ class TwitterBridge extends BridgeAbstract {
'required' => false,
'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'
)
)
);

Expand Down Expand Up @@ -145,6 +159,8 @@ public function getName(){
break;
case 'By list':
return $this->getInput('list') . ' - Twitter list by ' . $this->getInput('user');
case 'By list ID':
return 'Twitter List #' . $this->getInput('listid');
default: return parent::getName();
}
return 'Twitter ' . $specific . $this->getInput($param);
Expand All @@ -167,6 +183,10 @@ public function getURI(){
. urlencode($this->getInput('user'))
. '/lists/'
. str_replace(' ', '-', strtolower($this->getInput('list')));
case 'By list ID':
return self::URI
. 'i/lists/'
. urlencode($this->getInput('listid'));
default: return parent::getURI();
}
}
Expand All @@ -188,6 +208,11 @@ private function getApiURI() {
. '/2/timeline/list.json?list_id='
. $this->getListId($this->getInput('user'), $this->getInput('list'))
. '&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 !');
}
}
Expand Down Expand Up @@ -354,6 +379,7 @@ public function collectData(){

switch($this->queriedContext) {
case 'By list':
case 'By list ID':
// Check if filter applies to list (using raw content)
if($this->getInput('filter')) {
if(stripos($cleanedTweet, $this->getInput('filter')) === false) {
Expand Down

0 comments on commit b66026e

Please sign in to comment.