This commit is contained in:
logmanoriginal 2016-08-20 22:23:36 +02:00
commit d0461f3643

View file

@ -13,7 +13,7 @@ class TwitterBridge extends BridgeAbstract{
'[ '[
{ {
"name" : "Hide profile pictures", "name" : "Hide profile pictures",
"identifier" : "pic", "identifier" : "nopic",
"type" : "checkbox", "type" : "checkbox",
"required" : false, "required" : false,
"exampleValue" : "checked", "exampleValue" : "checked",
@ -42,6 +42,14 @@ class TwitterBridge extends BridgeAbstract{
"required" : true, "required" : true,
"exampleValue" : "sebsauvage", "exampleValue" : "sebsauvage",
"title" : "Insert a user name" "title" : "Insert a user name"
},
{
"name" : "Without replies",
"identifier" : "norep",
"type" : "checkbox",
"required" : false,
"exampleValue" : "checked",
"title" : "Only return initial tweets"
} }
]'; ]';
@ -53,15 +61,15 @@ class TwitterBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnServerError('No results for this query.'); $html = $this->getSimpleHTMLDOM('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnServerError('No results for this query.');
} }
elseif (isset($param['u'])) { /* user timeline mode */ elseif (isset($param['u'])) { /* user timeline mode */
$html = $this->getSimpleHTMLDOM('https://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnServerError('Requested username can\'t be found.'); $html = $this->getSimpleHTMLDOM('https://twitter.com/'.urlencode($param['u']).(isset($param['norep'])?'':'/with_replies')) or $this->returnServerError('Requested username can\'t be found.');
} }
else { else {
$this->returnClientError('You must specify a keyword (?q=...) or a Twitter username (?u=...).'); $this->returnClientError('You must specify a keyword (?q=...) or a Twitter username (?u=...).');
} }
$hidePictures = false; $hidePictures = false;
if (isset($param['pic'])) if (isset($param['nopic']))
$hidePictures = $param['pic'] === 'on'; $hidePictures = $param['nopic'] === 'on';
foreach($html->find('div.js-stream-tweet') as $tweet) { foreach($html->find('div.js-stream-tweet') as $tweet) {
$item = new \Item(); $item = new \Item();