GithubHelp home page GithubHelp logo

singhkshitij / twitterimgbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joaquinlpereyra/twitterimgbot

1.0 1.0 0.0 77 KB

Ever wanted to randomly tweet pictures from a folder? No? Well, maybe you do now.

License: GNU General Public License v3.0

Python 100.00%

twitterimgbot's Introduction

MyTrashCode Twitter bot

Twitter handle : @mytrashcode

What it does ?

It automatically posts random images with some hashtags on twitter to build social media presence for my blog Mytrashcode

You can find the setup instruction on the original repo here if you also want to build one.

From where do i get image ?

I scrap them in one shot from popular programming meme subreddits and uploaded to an static folder on a linux instance running all time.

Do i pay for linux instance ?

No. I run a lifetime free linux instance on GCP. It does the job for me.

Does the bot automatically post ?

No. I have scheduled a cron job to trigger randomly 3 times a day.

0 0,8,16 * * * sleep $(( RANDOM \% 14400 )); /usr/bin/python3 /home/kshitij.singh/twitterImgBot/twitterbot.py --tweet

It runs the python script and does the job.

Where do i store these images ?

In folder twitterImgBot/images/reddit_sub_ProgrammerHumor/

How do i scrap reddit images ?

This is a one time job, which i achieved with tool called ripme.

SSH to box and run

java -jar ripme.jar --url https://www.reddit.com/r/ProgrammerHumor/top/?t=year --ripsdirectory ./twitterImgBot/images/

Cleanup steps :

Remove videos or other non image files that could have been scraped also by running these commands :

ls | wc -l
find . -type f ! \( -name '*.jpg' -o -name "*.png" \) -delete
ls | wc -l

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.