@@ -16,36 +16,27 @@ Some of the benefits of using Tweep vs Twitter API:
...
@@ -16,36 +16,27 @@ Some of the benefits of using Tweep vs Twitter API:
- Python 3.5/3.6
- Python 3.5/3.6
-`pip3 install -r requirements.txt`
-`pip3 install -r requirements.txt`
## Usage
## Options
-`-u` The user's Tweets you want to scrape.
Command|Usage
-`-s` Search for Tweets containing this word or phrase.
-------|-----------
-`-g` Retrieve tweets by geolocation. Format of the argument is lat,lon,range(km or mi).
`-u`|The user's Tweets you want to scrape.
-`-o` Save output to a file.
`-s`|Search for Tweets containing this word or phrase.
-`-es` Output to Elasticsearch
`-g`|Retrieve tweets by geolocation. Format of the argument is lat,lon,range(km or mi).
-`--year` Filter Tweets before the specified year.
`-o`|Save output to a file.
-`--fruit` Display Tweets with "low-hanging-fruit".
`-es`|Output to Elasticsearch
-`--tweets` Display Tweets only.
`--year`|Filter Tweets before the specified year.
-`--verified` Display Tweets only from verified users (Use with `-s`).
`--fruit`|Display Tweets with "low-hanging-fruit".
-`--users` Display users only (Use with `-s`).
`--tweets`|Display Tweets only.
-`--csv` Write as a .csv file.
`--verified`|Display Tweets only from verified users (Use with `-s`).
-`--hashtags` Extract hashtags.
`--users`|Display users only (Use with `-s`).
-`--userid` Search from Twitter user's ID.
`--csv`|Write as a .csv file.
-`--limit` Number of Tweets to pull (Increments of 20).
`--json`|Write as a .json file.
-`--count` Display number Tweets scraped at the end of session.
`--hashtags`|Extract hashtags.
-`--stats` Show number of replies, retweets, and likes.
`--userid`|Search from Twitter user's ID.
`--limit`|Number of Tweets to pull (Increments of 20).
## Elasticsearch Setup
`--count`|Display number Tweets scraped at the end of session.
1. Go [here](https://www.elastic.co/downloads) and download `Elasticsearch` and `Kibana`, install both; (do this once)
`--stats`|Show number of replies, retweets, and likes.
2. Run `Elasticsearch` and than `Kibana`, in the Kibana output you should see "[info][status][plugin:elasticsearch@6.2.2] Status changed from yellow to green - Ready";
`--database`|Store Tweets in a SQLite database
3. Go to `http://localhost:5601`, `Dev Tools`, copy&paste from `index.json` and select the **green arrow**; (do this once)
4. Index some data: `python3.6 tweep.py --elasticsearch localhost:9200 -u whatsoever`;
5. Back to Kibana's interface, `Management`, `Index Pattern`, `Create Index Pattern`, type `tweep`, choose `datestamp` as Time filter; (do this once)
6. Have fun.
Unfortunately, you cannot import visualizations and/or dashboards if you do not have the same index id, so under `elasticsearch` directory I wrote a how-to for a initial setup.
If you have problems don't hesitate to write to the mainteiner [@pielco11](https://github.com/pielco11) or open an issue.
Feel free to edit the dashboard and don't hesitate to share it if you want.
## Low-Hanging Fruit
## Low-Hanging Fruit
The `--fruit` feature will display Tweets that *might* contain sensitive info such as:
The `--fruit` feature will display Tweets that *might* contain sensitive info such as:
...
@@ -68,6 +59,8 @@ A few simple examples to help you understand the basics:
...
@@ -68,6 +59,8 @@ A few simple examples to help you understand the basics:
-`python3 tweep.py -s "Donald Trump" --verified --users` - List verified users that Tweet about Donald Trump.
-`python3 tweep.py -s "Donald Trump" --verified --users` - List verified users that Tweet about Donald Trump.
-`python3 tweep.py -g="48.880048,2.385939,1km" -o file.csv --csv` - Scrape Tweets from a radius of 1km around a place in Paris and export them to a csv file.
-`python3 tweep.py -g="48.880048,2.385939,1km" -o file.csv --csv` - Scrape Tweets from a radius of 1km around a place in Paris and export them to a csv file.
-`python3 tweep.py -u username -o file.json --json` - Scrape Tweets and save as a json file.
-`python3 tweep.py -u username --database tweets.db` - Save Tweets to a SQLite database.
## Example String
## Example String
`955511208597184512 2018-01-22 18:43:19 GMT <now> pineapples are the best fruit`
`955511208597184512 2018-01-22 18:43:19 GMT <now> pineapples are the best fruit`
...
@@ -75,6 +68,18 @@ A few simple examples to help you understand the basics:
...
@@ -75,6 +68,18 @@ A few simple examples to help you understand the basics:
## Screenshot
## Screenshot
<imgsrc="https://i.imgur.com/RKdBrHr.png"/>
<imgsrc="https://i.imgur.com/RKdBrHr.png"/>
## Elasticsearch Setup
1. Go [here](https://www.elastic.co/downloads) and download `Elasticsearch` and `Kibana`, install both; (do this once)
2. Run `Elasticsearch` and than `Kibana`, in the Kibana output you should see "[info][status][plugin:elasticsearch@6.2.2] Status changed from yellow to green - Ready";
3. Go to `http://localhost:5601`, `Dev Tools`, copy&paste from `index.json` and select the **green arrow**; (do this once)
4. Index some data: `python3.6 tweep.py --elasticsearch localhost:9200 -u whatsoever`;
5. Back to Kibana's interface, `Management`, `Index Pattern`, `Create Index Pattern`, type `tweep`, choose `datestamp` as Time filter; (do this once)
6. Go back to `Management`, `Saved Objects`, Import `dashboard.json` and than `visualization.json`; (do this once)
7. Have fun.
If you have problems don't hesitate to write to open an issue.
Feel free to edit the dashboard and don't hesitate to share it if you want.
## Thanks
## Thanks
Thanks to [@hpiedcoq](https://github.com/hpiedcoq) & [@pielco11](https://github.com/pielco11) for contributing several features!
Thanks to [@hpiedcoq](https://github.com/hpiedcoq) & [@pielco11](https://github.com/pielco11) for contributing several features!