Skip to main content

Crunchyroll Guest Pass Publisher for Reddit

Project description

my badge

CrunchyBot

Description:

This is a simple bot/script I made to publish my CrunchyRoll Guest Passes to Reddit. It uses Selenium and Chromedriver to extract valid guest passes from CrunchyRoll and PRAW to publish it /r/Crunchyroll's weekly Megathread. This is not a bot made to run indefinitely; however, it can be altered to do so if one so desired. It was intended for use in conjunction with a task scheduler/cronjob to check once every month (or four if you wish to publish them in sets before guest passes expire) for new guest passes.

Changes:

Due to how the PRAW library has changed, all users now must create a reddit script app. As such, the data file now must include additional data. See below for a quick guide on how to set this up.

As of 4.0.0, binaries for chromedriver and other tooling will not be included. Please refer to link on setting up and installing chromedriver.

Setting Up Reddit Account:

  1. Log on to the bot account.
  2. Go the bot account's preferences from the upper-right corner.
  3. Click the apps tab.
  4. Click the create another app. - The button test may appear differently if you have no apps setup.
  5. In the prompts, ensure that the script radio button is toggled and redirected uri is is set to http://localhost:8080. The other fields can be filled with whatever you want.
  6. Click create app button when done.
  7. You should now see the app created. Right below the name and below personal use script will be your client_id. Within the box, to the right of the word secret, is your client_secret.

Prerequisites:

You will need to have Chrome installed on your system at its default installation path. This is due to the chromedriver working with your Chrome installation to retrieve Crunchyroll Guest Pass.

Note As of 4.0.0, chromedriver will not be provided. Please refer to link on setting up.

Install:

pip install crunchy-bot

Setup:

Run crunchy init to generate config file:

{
  "crunchy_username": "crunchy_user",
  "crunchy_password": "crunchy_pass",
  "reddit_client_id": "client_id",
  "reddit_client_secret": "client_secret",
  "reddit_user_agent": "CrunchyBot:v4.0.0 (hosted by /u/{YOUR_USERNAME})",
  "reddit_username": "reddit_user",
  "reddit_password": "reddit_pass",
  "log_dir": "/tmp/crunchybot/logs"
}

or save this to ~/.crunchybot.

Execute crunchy publish [--config path/to/.crunchybot] [--debug/-d] to start scrapping and publishing.

Development

With Pipenv

Assuming you have pipenv installed on your system, run the following within the repo:

$ pipenv --three

This will setup a virtual environment for Crunchybot to work in without interferring your other python projects.

With pipenv initialized, run:

$ pipenv install

This will use the Pipfile and Pipfile.lock to fetch and verify dependencies. Run pipenv shell to execute a shell into the generated virtual environment.

Without Pipenv

Install PRAW and Selenium by running the following command:

$ pip install -r requirements.txt

Once setup with or without pipenv, run pip install -e . within the repository. This should install a local version of crunchy_bot and its cli. This will also generate a version.py using setuptools_scm.

Make and test your changes locally. Pull Request are welcome.

Automating:

OSX/Linux

Run crontab -e and add

0 0 1 * * zsh -lc "/path/to/crunchy publish"

You can replace zsh -lc with your shell's equivalent. This is mainly to execute any of your profile presets that may handle setting up PATH and other required environment variables to run.

Windows

Add the Python script to the Windows Task Scheduler with monthly frequency. Here is a link to setup the Task Scheduler.

Github

You can also fork this repository and utilize Github Actions to run this task on the first of each month. You must add the required data as all cap snake case secret variables.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crunchy_bot-4.1.9.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

crunchy_bot-4.1.9-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file crunchy_bot-4.1.9.tar.gz.

File metadata

  • Download URL: crunchy_bot-4.1.9.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for crunchy_bot-4.1.9.tar.gz
Algorithm Hash digest
SHA256 104364e255532af0af18554bfb5e9ac6c1b7d264775d430329e435013dfef505
MD5 02faf8282a4f80d6c8638f7f9616d5ec
BLAKE2b-256 d65825c2de87ad4fb67490a585748bf61a626b20810ff56663e452f6e1be6988

See more details on using hashes here.

Provenance

File details

Details for the file crunchy_bot-4.1.9-py3-none-any.whl.

File metadata

  • Download URL: crunchy_bot-4.1.9-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for crunchy_bot-4.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 74490540a38187dfb59f078725550821e7773b41183ba09b53c2e776b195006f
MD5 a7cd8935d1bcad2299da53b679c92fdf
BLAKE2b-256 0d1de91a3979d84a9294f58ed0111332477bc853d82f372e24ecb274ffd06ba2

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page