eshameo045 commited on
Commit
5627958
·
1 Parent(s): 66d10f7
Files changed (1) hide show
  1. utils/transcript_handler.py +9 -1
utils/transcript_handler.py CHANGED
@@ -53,7 +53,15 @@ def get_transcript(url: str) -> dict:
53
  }
54
 
55
  except Exception as e:
56
- return {"success": False, "error": f"Error extracting transcript: {str(e)}"}
 
 
 
 
 
 
 
 
57
 
58
 
59
 
 
53
  }
54
 
55
  except Exception as e:
56
+ error_msg = str(e)
57
+ if "Subtitles are disabled" in error_msg or "subtitles" in error_msg.lower():
58
+ return {"success": False, "error": "⚠️ This video has no captions. Please use a video with CC enabled!"}
59
+ elif "No transcripts were found" in error_msg:
60
+ return {"success": False, "error": "⚠️ No transcript found. Please use a lecture video with captions!"}
61
+ elif "live streaming" in error_msg or "live" in error_msg.lower():
62
+ return {"success": False, "error": "⚠️ Live streams not supported. Please use a recorded lecture!"}
63
+ else:
64
+ return {"success": False, "error": "⚠️ Could not process video. Please use a lecture video with captions enabled!"}
65
 
66
 
67