This file contains 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
parameters={ | |
"likes": false, | |
"posts_by_others": true, | |
"comments": true, | |
"page_likes": false, | |
"like_counts": true | |
} | |
# flatten before URL-encoding |
This file contains 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
// Limit to twitter + english social data | |
interaction.type == "twitter" | |
and (twitter.lang == "en" or twitter.retweet.lang == "en") | |
// Use FOCUS to collect data from the entire industry | |
and focus.content.levels.level3 any "Automotive Vehicles" | |
and focus.content.levels.last exists | |
// Exclude generic automotive categories as we want to focus on brands | |
and not focus.content.levels.last in "Travel Trailers,Used Vehicles,Van & Minivan Price,Van & Minivan Specifications,Vintage,Trucks,Drag Racing Car,Kit Cars,Salvage Vehicles,Truck Specifications,New General Motors Vehicles,Diesel Trucks,Hot Rods,Gasoline Prices,Armored Cars,Oldsmobile,Campers & RVs,Trucks,Cars,GM,Soccer Scores & Statistics,Geo" |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 | |
// Include the library | |
require 'vendor/datasift/datasift-php/lib/datasift.php'; | |
// Create a client | |
$client = new DataSift_User('YOUR_USERNAME', 'YOUR_APIKEY'); | |
// Declare a filter in CSDL, looking for content mentioning brands, tagging each mentioned | |
$csdl = 'tag "Calvin Klein" { interaction.content contains "Calvin Klein" } |
This file contains 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 | |
// Declare a filter in CSDL, looking for content mentioning brands, tagging each mentioned | |
$csdl = 'tag.brand "Calvin Klein" { interaction.content contains "Calvin Klein" } | |
tag.brand "GQ" { interaction.content contains "GQ" } | |
tag.brand "Adidas" { interaction.content contains "Adidas" } | |
return | |
{ | |
interaction.content contains_any "Calvin Klein, GQ, Adidas" |
This file contains 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 | |
// Include all dependencies, via Composer | |
require 'vendor/autoload.php'; | |
// Create a client | |
$client = new DataSift_User('YOUR_USERNAME', 'YOUR_APIKEY'); | |
?> |
This file contains 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 | |
// Declare event handling object for stream consumption | |
class EventHandler implements DataSift_IStreamConsumerEventHandler | |
{ | |
public function onInteraction($consumer, $interaction, $hash) | |
{ | |
echo "INTERACTION: ".json_encode($interaction).PHP_EOL.PHP_EOL; | |
} | |
// Triggered when a connection is successfully setup |
This file contains 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 | |
// Compiles a stream from a CSDL definition, looking for all mentions of brands | |
$csdl = 'interaction.content contains_any "Calvin Klein, GQ, Adidas"'; | |
$filter = $client->createDefinition($csdl); | |
echo "Filter hash: " . $filter->getHash().PHP_EOL; | |
?> |
This file contains 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
{ | |
"require": { | |
"datasift/datasift-php": "*" | |
} | |
} |
This file contains 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
import com.datasift.client.DataSiftClient; | |
import com.datasift.client.DataSiftConfig; | |
import com.datasift.client.core.Stream; | |
import com.datasift.client.stream.*; | |
public class Main { | |
public static void main(String[] args) { | |
// TODO: Enter your username and API key |
NewerOlder