Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Kayvan Sylvan 2024-04-02 09:28:01 -07:00
commit 8934deabd9
2 changed files with 10 additions and 10 deletions

View File

@ -88,11 +88,11 @@ def main_function(url, options):
# Get video transcript
try:
transcript_list = YouTubeTranscriptApi.get_transcript(video_id)
transcript_list = YouTubeTranscriptApi.get_transcript(video_id, languages=[options.lang])
transcript_text = " ".join([item["text"] for item in transcript_list])
transcript_text = transcript_text.replace("\n", " ")
except Exception as e:
transcript_text = f"Transcript not available. ({e})"
transcript_text = f"Transcript not available in the selected language ({options.lang}). ({e})"
# Get comments if the flag is set
comments = []
@ -103,7 +103,7 @@ def main_function(url, options):
if options.duration:
print(duration_minutes)
elif options.transcript:
print(transcript_text)
print(transcript_text.encode('utf-8').decode('unicode-escape'))
elif options.comments:
print(json.dumps(comments, indent=2))
else:
@ -126,7 +126,8 @@ def main():
parser.add_argument('--duration', action='store_true', help='Output only the duration')
parser.add_argument('--transcript', action='store_true', help='Output only the transcript')
parser.add_argument('--comments', action='store_true', help='Output the comments on the video')
parser.add_argument('--lang', default='en', help='Language for the transcript (default: English)')
args = parser.parse_args()
if args.url is None:

11
poetry.lock generated
View File

@ -1470,17 +1470,16 @@ extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "aleph-alpha-client (>=2.15.
[[package]]
name = "langchain-core"
version = "0.1.31"
version = "0.1.35"
description = "Building applications with LLMs through composability"
optional = false
python-versions = ">=3.8.1,<4.0"
python-versions = "<4.0,>=3.8.1"
files = [
{file = "langchain_core-0.1.31-py3-none-any.whl", hash = "sha256:ff028f00db8ff03565b542cea81be27426022a72c6545b54d8de66fa00948ab3"},
{file = "langchain_core-0.1.31.tar.gz", hash = "sha256:d660cf209bb6ce61cb1c853107b091aaa809015a55dce9e0ce19b51d4c8f2a70"},
{file = "langchain_core-0.1.35-py3-none-any.whl", hash = "sha256:9d790446ea211f4cb620886081cc5a5723bc9a2dc90af1f6205aded2ee61bb71"},
{file = "langchain_core-0.1.35.tar.gz", hash = "sha256:862b8415d4deaf4e06833ef826bcef3614d75c3e7fd82b09b1349cc223f02e9a"},
]
[package.dependencies]
anyio = ">=3,<5"
jsonpatch = ">=1.33,<2.0"
langsmith = ">=0.1.0,<0.2.0"
packaging = ">=23.2,<24.0"
@ -3684,4 +3683,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "5732b76a0ab3501228efa6c0091e4a66bd84def76c8934f06b9219dc2c9d3ad3"
content-hash = "0cb2d2f8fc9cdfa79f9406a835251676f39db15de63b1ba1ef8f0fed71307f2b"