Skip to content

Commit 685a23e

Browse files
committed
`0.1708.4 - 403 error catching w/ detailed help
1 parent 7e997e6 commit 685a23e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ After launching your bot successfully, you can interact with it via Telegram (se
196196
- `/language` - set the model's transcription language (`auto` = autodetect); if you know the language spoken in the audio, setting the transcription language manually with this command may improve both transcription speed and accuracy.
197197

198198
## Changes
199+
- v0.1708.4 - Better error catching
200+
- Fixed the description and catching of i.e. YouTube's 403 errors
199201
- v0.1708.3 - Enforced chunk size double-check when sending transcripts as messages
200202
- This is to ensure we're staying under the message length cap in Telegram
201203
- v0.1708.2 - Added buffer for chunking

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# openai-whisper transcriber-bot for Telegram
44

55
# version of this program
6-
version_number = "0.1708.3"
6+
version_number = "0.1708.4"
77

88
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
# https://github.com/FlyingFathead/whisper-transcriber-telegram-bot/

src/transcription_handler.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,12 @@ async def process_url_message(message_text, bot, update, model, language):
515515
except Exception as e:
516516
error_message = str(e)
517517
logger.error(f"An error occurred while fetching video details: {error_message}")
518-
await bot.send_message(chat_id=update.effective_chat.id, text=f"❌ Error: {error_message}")
518+
# await bot.send_message(chat_id=update.effective_chat.id, text=f"❌ Error: {error_message}")
519+
await bot.send_message(
520+
chat_id=update.effective_chat.id,
521+
text=f"❌ Error: {error_message}",
522+
disable_web_page_preview=True
523+
)
519524
continue # Skip to the next URL if any
520525

521526
await bot.send_message(chat_id=update.effective_chat.id, text="📥 Fetching the audio track...")
@@ -750,13 +755,15 @@ async def fetch_video_details(url, max_retries=3, base_delay=5, command_timeout=
750755
"Sign in to confirm you're not a bot",
751756
"unable to extract initial player response",
752757
"This video is unavailable",
758+
"Error 403",
753759
"ERROR:"
754760
]):
755761
custom_error_message = (
756762
"❌ Failed to fetch video details due to YouTube's anti-bot measures or video restrictions. "
757-
"Possible reasons include age restrictions, region locks, or the video requiring sign-in. "
758-
"Please try a different video URL, or see type /help for supported file formats for delivery. "
759-
"If you are the administrator of this service, consider using cookies with `yt-dlp`."
763+
"Possible reasons include age restrictions, region locks, or the video requiring sign-in.\n"
764+
"\nPlease try a different video URL, or see type /help for supported file formats for delivery.\n"
765+
"\n⚠️ If you are the administrator of this service, consider using cookies with yt-dlp. "
766+
"More info on yt-dlp's cookies at: https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp"
760767
)
761768
raise Exception(custom_error_message)
762769
else:

0 commit comments

Comments
 (0)