Does this work on a AWS EC2 instance? #313
timbrowning327
started this conversation in
General
Replies: 1 comment
-
This works on GCP but not AWS. AWS must be blocking this package in some way |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My local machine runs the code no problem and can scrape the transcript but running it on the ec2 instance it returns null. Here is the code -
def get_youtube_transcript(video_url):
try:
yt = YouTube(video_url, on_progress_callback=on_progress)
transcript = yt.captions['a.en'].generate_srt_captions()
cleaned_transcript = re.sub(r'\d+\s*\n|\d{2}:\d{2}:\d{2},\d{3}\s*-->\s*\d{2}:\d{2}:\d{2},\d{3}\s*\n', '',
transcript)
cleaned_transcript = " ".join([line.strip() for line in cleaned_transcript.splitlines() if line.strip()])
return cleaned_transcript
except Exception as e:
print(f"Error fetching transcript for video {video_url}: {str(e)}")
return None
Is it blocked on EC2?
Beta Was this translation helpful? Give feedback.
All reactions