Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“° Kishor Publisher (ΰ€•ΰ€Ώΰ€Άΰ₯‹ΰ€° ΰ€ͺΰ€¬ΰ₯ΰ€²ΰ€Ώΰ€Άΰ€°)

Automated Telegram channel publisher for Kishor (ΰ€•ΰ€Ώΰ€Άΰ₯‹ΰ€°) monthly magazine archives published by Balbharati. Automatically detects new issues, schedules 1-hour staggered uploads, generates high-quality cover thumbnails, and publishes each magazine with bilingual metadata.

Daily Checker Telegram Bot Uploader Python License Support


⚑ Quick Overview

Source Platform Protocol Automation No Ads


πŸ“‹ Table of Contents


πŸ—οΈ Architecture & Workflow

sequenceDiagram
    autonumber
    participant Site as eBalbharati Archives
    participant Checker as checker.yml (Daily)
    participant State as state/pending_queue.json
    participant Cron as cron-job.org / GitHub API
    participant Uploader as uploader.yml (Per File)
    participant TG as Telegram Channel

    Checker->>Site: Scans for newly published monthly issues
    Site-->>Checker: Returns available PDF archives
    Checker->>State: Builds upload queue (1-hour gap schedule)
    Checker->>Cron: Schedules dynamic upload dispatch jobs
    Cron->>Uploader: Triggers job at scheduled time
    Uploader->>Site: Downloads PDF issue
    Uploader->>Uploader: Generates PyMuPDF HD thumbnail (quality=100)
    Uploader->>TG: Uploads via Pyrogram MTProto with bilingual caption
    Uploader->>State: Updates state/last_uploaded.txt & upload_history.md
Loading

Workflow Summary

Workflow Frequency / Trigger Function
checker.yml Daily at 00:00 UTC (05:30 IST) Scans eBalbharati Archives, builds upload queue with 1-hour IST intervals, and creates external cron jobs on cron-job.org.
uploader.yml Dynamic (repository_dispatch) Downloads single PDF issue, renders 100% quality cover thumbnail, verifies SHA-256 integrity, uploads to Telegram Channel, and cleans state.
bot.yml Every minute (via cron-job.org trigger) Polls Telegram for owner management commands (/status, /queue, /pause, /resume, /history).

πŸš€ Key Features

  • πŸ“° Automated Issue Scraper: Continuously monitors eBalbharati archives for new and historical issues of Kishor magazine.
  • ⏰ Smart IST Queue Engine: Automatically schedules uploads starting at 00:00 IST on day D+1 with a 1-hour gap between consecutive issue uploads.
  • πŸ–ΌοΈ PyMuPDF HD Cover Thumbnails: Generates uncompressed, high-definition JPEG thumbnails (quality=100) from the first page of each PDF issue.
  • ⚑ Pyrogram MTProto Protocol: Uploads directly via Telegram User/Bot MTProto client, supporting files up to 2 GB and bypassing Telegram Bot API's 50 MB restriction.
  • πŸ€– Interactive Admin Bot: Full remote control over channel queue and operational state directly from Telegram.
  • πŸ”„ Smart Disaster Recovery: Includes /resume command which calculates overdue items, re-dispatches pending uploads, and re-establishes missing cron jobs.
  • πŸ”’ SHA-256 Hash Verification: Computes and logs cryptographic hashes for every uploaded file inside state/upload_history.md.

πŸ“ Repository Structure

kishor-publisher/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ FUNDING.yml              # GitHub Sponsors & Ko-fi configuration
β”‚   └── workflows/
β”‚       β”œβ”€β”€ checker.yml          # Daily issue scanner & queue builder
β”‚       β”œβ”€β”€ uploader.yml         # Single-file download, thumbnail & MTProto uploader
β”‚       └── bot.yml              # Admin bot Telegram polling workflow
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ checker.py           # Core scanning & scheduling logic
β”‚   β”œβ”€β”€ uploader.py          # PDF fetching, rendering & Telegram publication
β”‚   β”œβ”€β”€ bot.py               # Telegram bot command dispatcher & /resume handler
β”‚   └── utils/
β”‚       β”œβ”€β”€ cronjob_api.py   # REST API wrapper for cron-job.org dynamic scheduling
β”‚       β”œβ”€β”€ github_api.py    # GitHub REST API workflow dispatch handler
β”‚       β”œβ”€β”€ naming.py        # Bilingual Marathi/English title formatting
β”‚       β”œβ”€β”€ notifications.py # Telegram notification templates
β”‚       β”œβ”€β”€ state.py         # State I/O, IST time conversions & Git commit helper
β”‚       β”œβ”€β”€ telegram_client.py  # Pyrogram MTProto uploader interface
β”‚       └── thumbnail.py     # PyMuPDF PDF page renderer
β”œβ”€β”€ state/
β”‚   β”œβ”€β”€ bot_offset.txt       # Managed Telegram update offset pointer
β”‚   β”œβ”€β”€ last_uploaded.txt    # Title of last published issue
β”‚   β”œβ”€β”€ pending_queue.json   # Queue of pending uploads with IST timestamps
β”‚   β”œβ”€β”€ upload_history.md    # Permanent publication log with SHA-256 checksums
β”‚   └── uploader_status.txt  # System state: 'active' or 'paused'
β”œβ”€β”€ GITHUB_SETTINGS.md       # Metadata guide for repo settings
β”œβ”€β”€ LICENSE                  # MIT License
└── requirements.txt         # Python dependencies

βš™οΈ Setup & Requirements

1. Configure GitHub Secrets

Navigate to Repo Settings β†’ Secrets and variables β†’ Actions and add the following:

Secret Name Description
TELEGRAM_API_ID Telegram API ID from my.telegram.org
TELEGRAM_API_HASH Telegram API Hash from my.telegram.org
TELEGRAM_BOT_TOKEN Bot Token obtained from @BotFather
TELEGRAM_OWNER_CHAT_ID Your numeric personal Telegram User ID
TELEGRAM_CHANNEL_ID Target Telegram Channel numeric ID (e.g. -100123456789)
GH_PAT GitHub Personal Access Token with repo and workflow permissions
CRON_JOB_ORG_API_KEY API key from cron-job.org (used for scheduling dynamic upload jobs)

2. Configure External Cron Trigger

Create a recurring 1-minute job on cron-job.org pointing to your bot.yml workflow trigger endpoint to ensure real-time command processing.


πŸ€– Telegram Bot Commands

Command Description
/status Displays operational state, last uploaded issue, and queue size.
/queue Displays full pending upload queue with IST schedule.
/last Shows detailed metadata of the last published issue.
/history Displays the last 30 entries from upload_history.md.
/pause Pauses automatic issue detection and upload execution.
/resume Resumes operations, re-enables schedule, and uploads overdue issues.
/help Lists all available commands and system information.

πŸ› οΈ Error Recovery

If a network or Telegram API error occurs during publication:

  1. The bot dispatches a complete error log & traceback directly to your private chat.
  2. Resolve the underlying issue or secret configuration.
  3. Send /resume to your Telegram bot. The system will automatically recalculate overdue uploads, re-trigger workflow dispatches, and re-create any missing cron jobs.

β˜• Support & Donations

This project is free, open-source, and maintained in free time. If it helped you or your community access Kishor magazine, consider supporting further development:

Donate via Ko-fi

All contributions are completely voluntary and deeply appreciated! ❀️


πŸ“„ License

Distributed under the MIT License.

About

Automated Telegram channel uploader for Kishor Marathi monthly magazine. Detects new issues on ebalbharati.in and publishes them.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages