Git Product home page Git Product logo

magic-the-gifening's Introduction

Magic: The GIFening

A Twitter bot which tweets Magic: the Gathering cards with appropriate GIFs superimposed onto them. Made in Python using the GIPHY API and MoviePy.

You can see the bot in action at the Twitter account @MTGIFening.

Some highlights:

In order to tweet on a regular schedule, the Dockerfile contains a cronjob which runs the script at the specified interval of time (currently set at 4 times a day/every 6 hours).

Usage

First, create a secrets.py with the appropriate GIPHY and Twitter API Keys:

GIPHY_API_KEY = '<FILL IN>'
CONSUMER_KEY = '<FILL IN>'
CONSUMER_SECRET = '<FILL IN>'
ACCESS_KEY = '<FILL IN>'
ACCESS_SECRET = '<FILL IN>'

The current list of cards used to generate images is derived from cards.csv. If you want to update the list, use get_cardlist.py and the AllSets.json file from MTG JSON.

Then run mtgifening.py and it should save and tweet a random GIF!

To run as a Twitter bot on the schedule, after you've added your secrets.py file, build the Docker container. Then run the container in detached mode, starting it up using /sbin/my_init:

docker run --rm -d magic /sbin/my_init

Notes

  • The files generated are actually videos, not proper GIFs. Videos are created much faster, take less disk space, and on Twitter, functionally identical to GIFs (videos less than 6 seconds will also autoloop).

Requirements

moviepy, ffmpeg, twython, Pillow

Maintainer/Creator

Max Woolf (@minimaxir)

Max's open-source projects are supported by his Patreon. If you found this project helpful, any monetary contributions to the Patreon are appreciated and will be put to good creative use.

License

MIT

magic-the-gifening's People

Contributors

minimaxir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.