https://github.com/neo4jrb/neo4apis-twitter
An ruby gem to import twitter data to neo4j
https://github.com/neo4jrb/neo4apis-twitter
Last synced: 5 months ago
JSON representation
An ruby gem to import twitter data to neo4j
- Host: GitHub
- URL: https://github.com/neo4jrb/neo4apis-twitter
- Owner: neo4jrb
- License: mit
- Created: 2014-10-29T23:42:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-09T10:12:45.000Z (about 10 years ago)
- Last Synced: 2024-11-09T09:06:32.708Z (5 months ago)
- Language: Ruby
- Homepage:
- Size: 247 KB
- Stars: 5
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this 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](https://github.com/sferik/twitter). 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
```ruby
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](https://dev.twitter.com/rest/reference/get/search/tweets):
`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](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](https://github.com/sferik/twitter/blob/master/examples/Configuration.md). The following is an example:
```yaml
---
:consumer_key:
:consumer_secret:
:access_token:
:access_token_secret:
```