From 4362972b3544eb4359eaa0cc7161d9aa02d5c2d5 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 4 Nov 2023 08:51:12 +0000 Subject: [PATCH] Format Python code with psf/black push --- models/index_model.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/index_model.py b/models/index_model.py index dee68cbf..f14fdab9 100644 --- a/models/index_model.py +++ b/models/index_model.py @@ -607,18 +607,21 @@ def index_gdoc(self, doc_id, service_context) -> GPTVectorStoreIndex: def index_youtube_transcript(self, link, service_context): try: + def convert_shortlink_to_full_link(short_link): # Check if the link is a shortened YouTube link if "youtu.be" in short_link: # Extract the video ID from the link - video_id = short_link.split('/')[-1].split('?')[0] + video_id = short_link.split("/")[-1].split("?")[0] # Construct the full YouTube desktop link desktop_link = f"https://www.youtube.com/watch?v={video_id}" return desktop_link else: return short_link - documents = YoutubeTranscriptReader().load_data(ytlinks=[convert_shortlink_to_full_link(link)]) + documents = YoutubeTranscriptReader().load_data( + ytlinks=[convert_shortlink_to_full_link(link)] + ) except Exception as e: raise ValueError(f"The youtube transcript couldn't be loaded: {e}")