Skip to content

[PL] Heroku bot wykorzystujący Selenium (chromedriver), Pillow, FFmpeg (FFmpy), youtube API oraz python-twitter żeby generować śmieszne obrazki.

License

Notifications You must be signed in to change notification settings

JakubKoralewski/idiotduo-twitter

Repository files navigation

idiot-duo-twitter

Obejrzyj jak działa na Twitterze! CircleCI CircleCI build artifacts Docker Automated build dla CircleCI GitHub

[PL] Losowy cytat z biblii / interesujące słownictwo + losowy moment z kanału Idiot Duo = najlepszy bot na Twitterze!

[EN] I have since regretted using the Polish language on GitHub; however, all the content related with this repo is in Polish which heavily contributed to my choice. Because of this the code is using Polish variable names and comments. For a quick overview check out this small description.

English description

This Python app runs on Heroku and posts images with funny quotes on them on Twitter. I am using Selenium WebDrivers to get Bible quotes online, youtube-dl and ffmpy (FFmpeg) to download single frames of videos from our YouTube channel, PIL (Pillow) to overlay text on images, Sentry to log errors and pytest for testing. Both Twitter APIs and YouTube APIs are leveraged. In case getting the Bible quotes online I also have an offline alternative in static/slowo_na_dzis.json which is a collection of lexical fun facts in Polish.

Checkout my other repos for English content! I was only starting my GitHub career when creating this repo and I should've used English.

Development

Install requirements: pip install -r requirements.txt. Advisable to use venv.

You need to create a config_secret.py in the bot directory, with the following values:

api_key = ''
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
sentry_url = ''
yandex_api = ''

You also need to download the chromedriver.exe for local development if you don't use Docker. I downloaded it from here and put it in my static folder. You need Google Chrome installed for this to work. Also make sure the version of the driver you download supports the Chrome browser version you have installed on your Windows machine.

Do the same for ffmpeg.exe which you can download here. Put it in the static directory.

The production server uses a Linux-based OS and will not use Windows' executables, this is only for development purposes. Only Windows has been tested and verified to be a usable development system. Feel free to hack the Dockerfile for your liking.

Testing

You should now be able to verify everything is working as it should by running the following:

Running the test will open the Chrome browser periodically as it tests certain functions related to Selenium, don't freak out.

py.test

You may add -n NUM where NUM is the amount of cores you want to use in parallel (or auto).

After the tests finish successfully you'll be left with 15 test images in tests/output that are stored here on each CI build.

About

[PL] Heroku bot wykorzystujący Selenium (chromedriver), Pillow, FFmpeg (FFmpy), youtube API oraz python-twitter żeby generować śmieszne obrazki.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published