Twitter doesn't seem to exclude anymore...

This commit is contained in:
Mitsukarenai 2014-11-27 17:15:39 +01:00
parent 2e2cf98eb6
commit e4b2a0b29c

View file

@ -8,20 +8,15 @@
* @homepage https://twitter.com/ * @homepage https://twitter.com/
* @description (same as Twitter Bridge, but with avatar, replies and RTs) * @description (same as Twitter Bridge, but with avatar, replies and RTs)
* @maintainer mitsukarenai * @maintainer mitsukarenai
* @use1(q="keyword or hashtag",e="exclude words (commasep)") * @use1(q="keyword or hashtag")
* @use2(u="username") * @use2(u="username")
*/ */
class TwitterBridgeExtended extends BridgeAbstract{ class TwitterBridgeExtended extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $exclude_request = ''; $html = '';
if (isset($param['q'])) { /* keyword search mode */ if (isset($param['q'])) { /* keyword search mode */
if(!empty($param['e'])) { $html = file_get_html('http://twitter.com/search/realtime?q='.urlencode($param['q']).'+include:retweets&src=typd') or $this->returnError('No results for this query.', 404);
$exclude = explode(',', $param['e']);
foreach($exclude as $exclude_pattern)
$exclude_request .= " -$exclude_pattern";
}
$html = file_get_html('http://twitter.com/search/realtime?q='.urlencode($param['q']).urlencode($exclude_request).'+include:retweets&src=typd') or $this->returnError('No results for this query.', 404);
} }
elseif (isset($param['u'])) { /* user timeline mode */ elseif (isset($param['u'])) { /* user timeline mode */
$html = file_get_html('http://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404); $html = file_get_html('http://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404);