Closed Areesha1801 closed 4 months ago
Hi @Areesha1801, I don't know YoutubeLoader
and how it works, so I can't speak to that.
Using this module I can run the following without a problem:
YouTubeTranscriptApi.list_transcripts("9kpl7AtE03c").find_transcript(["de"]).translate("en").fetch()
so it doesn't seem like it is an issue related to this module.
Can you open the URL in the Exception? Maybe the from_youtube_url
method doesn't parse the video ID from the video URL correctly. You should probably isolate the issue a bit further, to make sure where it is coming from, since there's a few different modules at play here.
I am trying to retrieve transcripts of some YouTube videos. I enlisted URLs in my csv file and after extraction tried to write extracted contents in txt files separately for each file. Getting the following output:
Error extracting transcript for V1: Could not retrieve a transcript for the video "URL mentioned" Client Error: Too Many Requests for url: "URL mentioned" This is most likely caused by:
Request to YouTube failed: 9kpl7AtE03c
If you are sure that the described cause is not responsible for this error and that a transcript should be retrievable, please create an issue at https://github.com/jdepoix/youtube-transcript-api/issues. Please add which version of youtube_transcript_api you are using and provide the information needed to replicate the error. Also make sure that there are no open issues which already describe your problem! following is my code:
import csv import os import re from langchain_community.document_loaders import YoutubeLoader from langchain_community.document_loaders.youtube import TranscriptFormat
def sanitize_filename(filename): return re.sub(r'[\/*?:"<>|]', "", filename)
def document_to_string(document):
Assuming that the Document object has a method or attribute to get its text
def extract_and_save_transcripts(csv_filepath):
Ensure the data directory exists
csv_filepath = 'data/VideoURLs.csv' extract_and_save_transcripts(csv_filepath)