Skip to content

Proyag/heardle-telegram

Repository files navigation

Heardle-telegram

Like Heardle, but with a customised list of songs and [for now] in the form of a telegram bot instead of a web UI.

Setup

Install dependencies

conda create -n heardle-telegram python=3.10
sudo apt install ffmpeg
pip install -r requirements.txt

Configure ytmusicapi headers

Then set up ytmusicapi headers according to https://ytmusicapi.readthedocs.io/en/latest/setup.html.

Step 1: Get header info

  • Go to https://music.youtube.com and ensure you are logged in
  • Find an authenticated POST request. The simplest way is to filter by /browse using the search bar of the developer tools. If you don’t see the request, try scrolling down a bit or clicking on the library button in the top bar.
Firefox
  • Verify that the request looks like this: Status 200, Method POST, Domain music.youtube.com, File browse?...
  • Copy the request headers (right click > copy > copy request headers)
Chromium (Chrome/Edge/Brave)
  • Verify that the request looks like this: Status 200, Type xhr, Name browse?...
  • Click on the Name of any matching request. In the “Headers” tab, scroll to the section “Request headers” and copy everything starting from “accept: /” to the end of the section

Step 2: Create file with these credentials

from ytmusicapi import YTMusic
YTMusic.setup(filepath="headers_auth.json")

Then paste what you got in the previous step, and press Ctrl+D.

Configure Telegram Bot API

Next, create a JSON file called telegram_config.json like this:

{
    "api_token": "Fill in your Bot API Token",
    "subscribers": []
}

with your telegram API token for this bot in api_token and a list of chat IDs for subscribers who will get new game notifications in subscribers.

Run

Run a game with

python heardle-telegram.py

Options:

--no-notify: Don't send notifications to subscribed telegram chats. (Useful while testing) --log-file LOG_FILE: File to write logs (in addition to console) --cache CACHE: File to use as library of songs (default: library_cache) --telegram-config TELEGRAM_CONFIG: File containing config data for Telegram (default: telegram_config.json) --max-suggestions MAX_SUGGESTIONS: Maximum number of suggestions shown while guessing (default: 999)

About

Telegram bot version of Heardle with custom song lists from YouTube Music

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages