No commit activity in last 3 years
No release in over 3 years
A ruby gem using neo4apis to make importing twitter data to neo4j easy
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.8.1
~> 5.12.0
 Project Readme

Introduction

neo4apis-twitter is a ruby gem for making importing data from twitter to neo4j easy

This adapter supports objects created from the twitter gem. Currently supports importing User and Tweet

You can either use the gem to write custom ruby code to import data or you can simply use the command-line interface.

Installation

gem 'neo4apis-twitter' in your Gemfile or gem install neo4apis-twitter

Usage

Ruby code

twitter_client = Twitter::REST::Client.new ...

neo4japis_twitter = Neo4Apis::Twitter.new(Neo4j::Session.open,
                                          import_retweets: true,
                                          import_hashtags: true)

neo4japis_twitter.batch do 
  twitter_client.search("ebola", :result_type => "recent").take(100).each do |tweet|
    # Imports:
    #  * The tweet
    #  * The tweeter, 
    #  * The original tweet if a retweet
    #  * The user for the original tweet
    neo4apis_client.import :Tweet, tweet
  end
end

Command Line

Import tweets as a stream:

neo4apis twitter filter TRACK

Import tweets via a search query:

neo4apis twitter search QUERY COUNT

Supports optional arguments from the twitter API:

neo4apis twitter search QUERY COUNT --result-type=[mixed|recent|popular]

Supported options:

  • geocode
  • lang
  • locale
  • result_type
  • until
Config file

Register your app for a Twitter key and token at https://apps.twitter.com. You will need to provide a URL and can use http://127.0.0.1.

The default path for the config file is config/twitter.yml, but you can specify your path with the --config-path option. The configuration file should match the keys in the twitter gem`s documentation. The following is an example:

---
:consumer_key: <consumer_key>
:consumer_secret: <consumer_secret>
:access_token: <access_token>
:access_token_secret: <access_token_secret>