Skip to main content

A Telegram Bot to stream contents (Telegram videos, Youtube videos and more) to your smart TV

Project description

CastBot

A Telegram Bot to stream contents (Telegram videos, Youtube videos and more) to your smart TV

flake8

Demonstration video

poc

Feature

  • Stream Telegram videos to any device that supports UPnP (AVTransport), Chromecast, Vlc (telnet api), Kodi (xbmc http api)
  • Web interface that plays videos in your browser
  • Download videos by URLs and stream to devices

Known issues

How-to setup (Release from pypi)

Make sure you have an updated version of python, only the latest version will be supported

  • Install Poetry if it's not installed yet
  • Clone the repository
  • Install python dependencies
  • Copy config.ini.example to config.ini
  • Edit config.ini
  • Start from python entrypoint
# install poetry
curl -sSL https://install.python-poetry.org | python3 -

git clone https://github.com/zhongkechen/castbot
cd castbot
poetry install
cp config.toml.example config.toml
nano config.toml
poetry run castbot -c config.toml -v 1

How-to setup (Docker)

  • Copy config.ini.example to config.ini
  • Edit config.ini
  • Build Docker image
  • Start Docker container
cp config.toml.example config.toml
nano config.toml
docker image build -t castbot:latest .
docker run --network host -v "$(pwd)/config.toml:/app/config.toml:ro" -d castbot:latest

FAQ

Q: How do I use the web interface?

A: Set enabled to 1 in web_ui config block, and change the password

  • open http://listen_ip:listen_port/static/index.html

  • now if you send a video in the bot on telegram you can choose to play it in the browser

Q: My Firewall block upnp and broadcasting, how can use kodi without it

A: Set xbmc_enabled to 1 and add your kodi device to xbmc_devices list

Q: What is the format of xbmc_devices

A: A List of Python Dict with host, port, (and optional: username and password)

example: [{"host": "192.168.1.2", "port": 8080, "username": "pippo", "password": "pluto"}]

Q: How-To control vlc from this bot

A: set vlc_enabled to 1 and add your vlc device to vlc_devices list

Q: What is the format of vlc_devices

A: A List of Python Dict with host, port, (and optional: password)

example: [{"host": "127.0.0.1", "port": 4212, "password": "123"}]

Q: How-To enable upnp on my device that use kodi

A: follow this guide (you should enable remote control)

Q: How do I get a token?

A: From @BotFather

Q: How do I set up admins?

A: You have to enter your user_id, there are many ways to get it, the easiest is to use @getuseridbot

Q: How do I get an app_id and app_hash?

A: https://core.telegram.org/api/obtaining_api_id#obtaining-api-id

Q: The video keeps freezing

A: Check the video bitrate, this bot supports maximum ~4.5Mb/s

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

castbot-1.4.0.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

castbot-1.4.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file castbot-1.4.0.tar.gz.

File metadata

  • Download URL: castbot-1.4.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for castbot-1.4.0.tar.gz
Algorithm Hash digest
SHA256 15ff4cfdc46bd8e57b34a08e9db877d8d95e43993bc2dd761c2e1c674e1eb96f
MD5 14662435cf19a18e5fccb911066b9f50
BLAKE2b-256 8deab7f3d81cf4249cac4bc0cdf7484215bfa6638abb8d46f6be968565e56b20

See more details on using hashes here.

File details

Details for the file castbot-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: castbot-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for castbot-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1baacfae48d23accdcfe56f6f220eba134b69853a084d430b7b8c16df886122d
MD5 751718891a50dd4cb6931709e2947485
BLAKE2b-256 6dab058968bfe4b22793bc4361b45c4fa95ab440632bd55cb7989df598ea84dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page