{"product_id":"telegram-youtube-downloader-n8n-workflow-mp3-mp4-via-ytdlp-api","title":"Telegram YouTube Downloader n8n Workflow (MP3\/MP4) via ytdlp-api","description":"\u003ch3\u003eTurn Telegram into a YouTube (MP3\/MP4) Downloader with ytdlp-api — powered by n8n\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow lets users request YouTube downloads directly in Telegram. It uses \u003cb\u003eytdlp-api\u003c\/b\u003e to probe\/search and download media, then delivers \u003cb\u003eMP3\/MP4\u003c\/b\u003e files (or cached Telegram \u003ci\u003efile_id\u003c\/i\u003e results) back to the chat for fast, repeat-friendly delivery.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cp\u003eBuilt around a Telegram bot experience with interactive cards and inline mode, the workflow:\u003c\/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eTriggers on Telegram messages, button presses, and inline queries\u003c\/b\u003e using the Telegram bot.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eHandles inline queries\u003c\/b\u003e by checking a \u003cb\u003ePostgreSQL cache\u003c\/b\u003e first, optionally running a live \u003cb\u003eytdlp-api search\u003c\/b\u003e, and then answering with cached \u003cb\u003eaudio\/video file_ids\u003c\/b\u003e or deep links back to the bot.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eHandles message inputs\u003c\/b\u003e by parsing YouTube\/playlist links, supported non-YouTube links, search terms, or a \u003cb\u003e\/stats\u003c\/b\u003e command.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eProbes media via ytdlp-api\u003c\/b\u003e, then sends a Telegram photo card with download buttons for \u003cb\u003eMP3\/MP4\u003c\/b\u003e (and playlist audio when applicable).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eOn download button taps\u003c\/b\u003e, optionally re-probes playlists to create a per-track job list, updates a progress message, and checks PostgreSQL for an existing cached \u003cb\u003eTelegram file_id\u003c\/b\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eOn cache hits\u003c\/b\u003e, sends the cached file directly from Telegram and records the cache hit in PostgreSQL.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eOn cache misses\u003c\/b\u003e, downloads\/streams through ytdlp-api, uploads to Telegram as audio or video, cleans up server-side job files, and stores the resulting \u003cb\u003efile_id\u003c\/b\u003e plus download history in PostgreSQL (or records failures).\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eGive your users a Telegram interface to fetch \u003cb\u003eYouTube MP3\/MP4\u003c\/b\u003e without leaving chat.\u003c\/li\u003e\n  \u003cli\u003eBuild a SaaS-style “download assistant” where repeat requests benefit from \u003cb\u003ePostgreSQL caching\u003c\/b\u003e.\u003c\/li\u003e\n  \u003cli\u003eEnable quick search and delivery using Telegram \u003cb\u003einline mode\u003c\/b\u003e results with cached file_ids.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eTelegram\u003c\/b\u003e (bot token from \u003cb\u003e@BotFather\u003c\/b\u003e, interactive cards, inline queries)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eytdlp-api\u003c\/b\u003e (probing, search, and downloads)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003ePostgreSQL\u003c\/b\u003e (cache and statistics; stores Telegram \u003cb\u003efile_id\u003c\/b\u003e + download history)\u003c\/li\u003e\n  \u003cli\u003en8n logic nodes such as \u003cb\u003eif\u003c\/b\u003e, \u003cb\u003ecode\u003c\/b\u003e, \u003cb\u003eswitch\u003c\/b\u003e, plus supporting nodes like \u003cb\u003esticky note\u003c\/b\u003e\n\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45872821534899,"sku":"N8N-18471","price":78.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/vETzANxz1Q5hpMeGGzfqx_MLGH9Z9S.png?v=1787217129","url":"https:\/\/buyflowscripts.com\/products\/telegram-youtube-downloader-n8n-workflow-mp3-mp4-via-ytdlp-api","provider":"N8N Commerce","version":"1.0","type":"link"}