A bot that posts a Hadith every hour on Twitter & Facebook with python

Hadith Every Hour

A bot that posts a Hadith every hour on Twitter & Facebook.

(Every 3 hours for now to avoid spamming)

Status

Currently posting the Hadiths from Sahih al-Bukhari in serial.

Concept

It’s really simple. GitHub action is written in this file. You can notice a scheduler –

on:
  schedule:
    - cron: "0 */3 * * *"

And the rest of the process is self explanatory.

A tracker is used to put the latest posted Hadith number in the hadith_track.json file.

API’s are from this project – https://github.com/Ananto30/ask-hadith

Flow

Get last Tweeted Hadith number from tracker

Get Hadith from API

Make chunks for long Hadith

Limit chunks for very long Hadith

Tweet and

 

 

 

To finish reading, please visit source site