Skip to content

Commit

Permalink
YouTube transcript fetching warning
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihozturkh2o committed Nov 1, 2024
1 parent 6a934de commit 7c78134
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openai_server/browser/mdconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ def convert(self, local_path, **kwargs) -> Union[None, DocumentConverterResult]:
if description:
webpage_text += f"\n### Description\n{description}\n"

# TODO: Warning, YouTube blocks get_transcript requests coming from non-static IPs like from cloud servers, docker containers, etc.
# That is, this part works only if the server is running on a static IP, e.g. local development.
# For more: https://github.com/jdepoix/youtube-transcript-api/issues/303
# This issue needs to be fixed, otherwise, transcripts won't be available during YouTube video interactions, hence, impossible to answer YouTube video questions.
if IS_YOUTUBE_TRANSCRIPT_CAPABLE:
transcript_text = ""
parsed_url = urlparse(url)
Expand All @@ -253,7 +257,8 @@ def convert(self, local_path, **kwargs) -> Union[None, DocumentConverterResult]:
# Alternative formatting:
# formatter = TextFormatter()
# formatter.format_transcript(transcript)
except:
except Exception as e:
print(f"Error getting transcript for YouTube video with the id '{video_id}' : {e}")
pass
if transcript_text:
webpage_text += f"\n### Transcript\n{transcript_text}\n"
Expand Down

0 comments on commit 7c78134

Please sign in to comment.