Package: crunchy-bot
CrunchyBotDescription: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 areddit 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 of4.0.0, binaries forchromedriverand other tooling will not be included.
Please refer tolinkon setting up and installingchromedriver.Setting Up Reddit Account:Log on to the bot account.Go the bot account'spreferencesfrom the upper-right corner.Click theappstab.Click thecreate another app.
- The button test may appear differently if you have no apps setup.In the prompts, ensure that thescriptradio button is toggled andredirected uriis is set tohttp://localhost:8080. The other fields
can be filled with whatever you want.Clickcreate appbutton when done.You should now see the app created. Right below the name and belowpersonal use scriptwill be yourclient_id. Within the box, to the right of the wordsecret, is yourclient_secret.Prerequisites:You will need to have Chrome installed on your system at its default installation path.
This is due to thechromedriverworking with your Chrome installation to retrieve
Crunchyroll Guest Pass.NoteAs of4.0.0,chromedriverwill not be provided.
Please refer tolinkon setting up.Install:pip install crunchy-botSetup:Runcrunchy initto 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.Executecrunchy publish [--config path/to/.crunchybot] [--debug/-d]to start scrapping and publishing.DevelopmentWith PipenvAssuming you havepipenvinstalled on your system, run the following within the repo:$ pipenv --threeThis will setup a virtual environment for Crunchybot to work in without interferring your
other python projects.Withpipenvinitialized, run:$ pipenv installThis will use thePipfileandPipfile.lockto fetch and verify dependencies. Runpipenv shellto
execute a shell into the generated virtual environment.Without PipenvInstall PRAW and Selenium by running the following command:$ pip install -r requirements.txtOnce setup with or withoutpipenv, runpip install -e .within the repository. This
should install a local version ofcrunchy_botand its cli. This will also generate
aversion.pyusingsetuptools_scm.Make and test your changes locally. Pull Request are welcome.Automating:OSX/LinuxRuncrontab -eand add0 0 1 * * zsh -lc "/path/to/crunchy publish"You can replacezsh -lcwith your shell's equivalent. This is mainly to execute any of your profile
presets that may handle setting upPATHand other required environment variables to run.WindowsAdd the Python script to the Windows Task Scheduler with monthly frequency.
Here is alinkto setup the Task Scheduler.GithubYou can also fork this repository and utilizeGithub Actionsto run this task on the first of each month.
You must add the required data as all cap snake case secret variables.