summaryrefslogtreecommitdiff
path: root/bridges/TwitterBridge.php
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/TwitterBridge.php')
-rw-r--r--bridges/TwitterBridge.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php
index d588f6b..aedb372 100644
--- a/bridges/TwitterBridge.php
+++ b/bridges/TwitterBridge.php
@@ -44,6 +44,25 @@ class TwitterBridge extends BridgeAbstract {
'type' => 'checkbox',
'title' => 'Hide retweets'
)
+ ),
+ 'By list' => array(
+ 'user' => array(
+ 'name' => 'User',
+ 'required' => true,
+ 'exampleValue' => 'sebsauvage',
+ 'title' => 'Insert a user name'
+ ),
+ 'list' => array(
+ 'name' => 'List',
+ 'required' => true,
+ 'title' => 'Insert the list name'
+ ),
+ 'filter' => array(
+ 'name' => 'Filter',
+ 'exampleValue' => '#rss-bridge',
+ 'required' => false,
+ 'title' => 'Specify term to search for'
+ )
)
);
@@ -57,6 +76,8 @@ class TwitterBridge extends BridgeAbstract {
$specific = '@';
$param = 'u';
break;
+ case 'By list':
+ return $this->getInput('list') . ' - Twitter list by ' . $this->getInput('user');
default: return parent::getName();
}
return 'Twitter ' . $specific . $this->getInput($param);
@@ -74,6 +95,11 @@ class TwitterBridge extends BridgeAbstract {
. urlencode($this->getInput('u'));
// Always return without replies!
// . ($this->getInput('norep') ? '' : '/with_replies');
+ case 'By list':
+ return self::URI
+ . urlencode($this->getInput('user'))
+ . '/lists/'
+ . str_replace(' ', '-', strtolower($this->getInput('list')));
default: return parent::getURI();
}
}
@@ -88,6 +114,8 @@ class TwitterBridge extends BridgeAbstract {
returnServerError('No results for this query.');
case 'By username':
returnServerError('Requested username can\'t be found.');
+ case 'By list':
+ returnServerError('Requested username or list can\'t be found');
}
}
@@ -132,6 +160,18 @@ class TwitterBridge extends BridgeAbstract {
// generate the title
$item['title'] = strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '<a>'));
+ switch($this->queriedContext) {
+ case 'By list':
+ // Check if filter applies to list (using raw content)
+ if($this->getInput('filter')) {
+ if(stripos($tweet->find('p.js-tweet-text', 0)->plaintext, $this->getInput('filter')) === false) {
+ continue 2; // switch + for-loop!
+ }
+ }
+ break;
+ default:
+ }
+
$this->processContentLinks($tweet);
$this->processEmojis($tweet);