sudo aptitude install git php5-cli nodejs
npm install -g npm
npm install -g maxogden/dat
dat init
dat listen
- Create a Twitter application and generate OAuth keys for your user - add the app and user credentials to
stream.php
. composer init && composer require fennb/phirehose:dev-master && composer install
php stream.php | dat import -json
- Install and start dat-editor then open dat-editor to browse the table.
Last active
August 29, 2015 14:05
-
-
Save hubgit/146530312e3f6c860a8f to your computer and use it in GitHub Desktop.
Stream filtered tweets into dat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
class FilterTrackConsumer extends OauthPhirehose { | |
public function enqueueStatus($status) { | |
print $status . "\n"; | |
} | |
} | |
// Application OAuth credentials | |
define('TWITTER_CONSUMER_KEY', '***');// "API key" | |
define('TWITTER_CONSUMER_SECRET', '***'); // "API secret" | |
// User OAuth credentials | |
define('OAUTH_TOKEN', '***'); // "Access token" | |
define('OAUTH_SECRET', '***'); // "Access token secret" | |
// start streaming | |
$consumer = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER); | |
$consumer->setLang('en'); | |
$consumer->setTrack(array('wikipedia')); | |
$consumer->consume(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment