rails app that takes and stores pastes from pastebin
Find a file
2019-10-30 03:02:52 -05:00
bin removed trending option from optionparser 2019-10-30 03:02:52 -05:00
config removed uneeded config options 2019-10-29 21:33:06 -05:00
examples converting to standalone gem for basic interaction with pastebin api and cmdline client 2019-10-29 21:01:03 -05:00
lib removed uneeded config options 2019-10-29 21:33:06 -05:00
spec made elastic search helper better and made pastebinner pack json 2019-02-01 22:19:36 -06:00
.gitignore added to gitignore and added the required environment vars in dockerfile 2019-04-06 00:59:19 -05:00
.rspec initial commit 2018-08-16 14:54:08 -05:00
.travis.yml initial commit 2018-08-16 14:54:08 -05:00
Dockerfile removed those env vars in the docker file. they can be specified in an environment file in the docker run process instead. i will detail how to do that in the readme file 2019-04-06 01:03:20 -05:00
Gemfile made elastic search helper better and made pastebinner pack json 2019-02-01 22:19:36 -06:00
LICENSE Initial commit 2018-08-16 14:52:20 -05:00
pastebinner.gemspec converting to standalone gem for basic interaction with pastebin api and cmdline client 2019-10-29 21:01:03 -05:00
Rakefile made elastic search helper better and made pastebinner pack json 2019-02-01 22:19:36 -06:00
README.md added a lttle bit more concise of an update to the docker part of tje readme 2019-04-06 02:09:13 -05:00
README.md.default made an actual readme to explain how to download pastes 2018-11-09 22:53:09 -06:00

Pastebinner

Check out the examples folder for some examples. I will add more soon.

Configuration

Docker

  • Build the image:
docker build -t pastebinner .
  • Run the image:
docker run -it --env-file .env --network="host" pastebinner

Console

The console will launch you into a running pry session where you will have access to an elasticsearch object and a pastebinner object. From there you can poke around and investigate further how the program works.

I am working on setting it up with docker-compose to connect elasticsearch and redis in docker containers. Set the following environment variables in a file named .env and source them:

pastebin_api_key
pastebin_username
pastebin_password

optional environment variables if planning on using elasticsearch and redis

elasticsearch_url
redis_url

If you want to scrape pastes, you can view a json response of the latest pastes by using the -s or --scrape_public options. Creating pastes is built in, check lib/api_client

Commandline

The command line app can be used as follows:

Usage: pastebinner [options]
    -h, --help                       Show this help messae
    -v, --verbose                    Verbose http output (WIP)
    -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
    -j, --json                       Download all public pastes as a json into data directory
    -t, --trending                   Trending pastes

Downloading pastes

Create a directory in the git repo named data, this is where the raw pastes will be stored. Here is an example of what it looks like:

Raw pastes to files
pastebinner --download
Downloading paste data into the data directory...
Complete.
JSON file with paste_metadata and paste_text
pastebinner --json
Downloading paste data as a json into the data directory...
Complete.

The data directory will then be populated with pastebin raw paste files with the following naming scheme:

pastebin_paste_key_agiArDuG.raw or pastebin_paste_key_agiArDuG.json

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