2018-08-16 14:54:08 -05:00
|
|
|
# Pastebinner
|
2018-11-09 22:53:09 -06:00
|
|
|
Check out the examples folder for some examples. I will add more soon.
|
2018-08-16 14:54:08 -05:00
|
|
|
|
|
|
|
## Usage
|
2018-11-09 22:58:47 -06:00
|
|
|
Set the following environment variables:
|
2018-08-16 14:54:08 -05:00
|
|
|
|
2018-11-09 22:53:09 -06:00
|
|
|
```
|
|
|
|
pastebin_api_key
|
|
|
|
pastebin_username
|
|
|
|
pastebin_password
|
|
|
|
```
|
2018-08-16 14:54:08 -05:00
|
|
|
|
2018-11-09 22:53:09 -06:00
|
|
|
If you want to scrape pastes, you can view a json response of the latest pastes by using the ```-s``` or ```--scrape_public``` options.
|
2018-11-09 22:58:47 -06:00
|
|
|
Creating pastes is built in, check ```lib/pastebinner.rb```, I am still working on adding in the functionality to use it on the command line.
|
|
|
|
The command line app can be used as follows:
|
2018-11-09 22:53:09 -06:00
|
|
|
|
|
|
|
```shell
|
|
|
|
Usage: pastebinner [options]
|
|
|
|
-h, --help Show this help messae
|
2019-02-02 04:54:26 -06:00
|
|
|
-v, --verbose Verbose http output (WIP)
|
2018-11-09 22:53:09 -06:00
|
|
|
-s, --scrape_public Scrape public pastes
|
|
|
|
-r, --raw Raw paste. Requires --key passed with a valid key
|
|
|
|
-g, --get_keys Get unique paste keys from public pastes
|
|
|
|
-k, --key= Unique paste key
|
|
|
|
-d, --download Download all public pastes to data directory
|
2019-02-02 04:54:26 -06:00
|
|
|
-j, --json Download all public pastes as a json into data directory
|
2018-11-09 22:53:09 -06:00
|
|
|
-t, --trending Trending pastes
|
|
|
|
```
|
|
|
|
### Downloading pastes
|
|
|
|
Create a directory in the git repo named data, this is where the raw pastes will be stored.
|
2018-11-09 22:58:47 -06:00
|
|
|
Here is an example of what it looks like:
|
2018-11-09 22:53:09 -06:00
|
|
|
|
2019-02-02 04:55:46 -06:00
|
|
|
##### Raw pastes to files
|
2018-11-09 22:53:09 -06:00
|
|
|
```shell
|
|
|
|
pastebinner --download
|
|
|
|
Downloading paste data into the data directory...
|
|
|
|
Complete.
|
|
|
|
```
|
2018-08-16 14:54:08 -05:00
|
|
|
|
2019-02-02 04:55:46 -06:00
|
|
|
##### JSON file with paste_metadata and paste_text
|
2019-02-02 04:54:26 -06:00
|
|
|
```shell
|
|
|
|
pastebinner --json
|
|
|
|
Downloading paste data as a json into the data directory...
|
|
|
|
Complete.
|
|
|
|
```
|
2018-11-09 22:53:09 -06:00
|
|
|
The data directory will then be populated with pastebin raw paste files with the following naming scheme:
|
2018-08-16 14:54:08 -05:00
|
|
|
|
2018-11-09 22:53:09 -06:00
|
|
|
```shell
|
2019-02-02 04:54:26 -06:00
|
|
|
pastebin_paste_key_agiArDuG.raw
|
|
|
|
```
|
|
|
|
or
|
|
|
|
```shell
|
|
|
|
pastebin_paste_key_agiArDuG.json
|
2018-11-09 22:53:09 -06:00
|
|
|
```
|
2018-11-09 22:58:47 -06:00
|
|
|
### To Add:
|
|
|
|
- fulltext search of raw pastes via elastic search, mysql, postgres, sqlite, or some other method
|
|
|
|
- adding exceptions
|
|
|
|
- adding configuration file support
|
|
|
|
- adding rspec tests
|