Spaces:
Sleeping
Sleeping
mohammadreza pakzadian commited on
Commit ·
ca403c2
1
Parent(s): cdf9023
update youtube transcript tool
Browse files
tools/youtube_transcript.py
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
-
from typing import Any, Optional
|
| 2 |
from smolagents.tools import Tool
|
| 3 |
-
import duckduckgo_search
|
| 4 |
|
| 5 |
class YoutubeTranscriptTool(Tool):
|
| 6 |
name = "youtube_transcript"
|
|
@@ -8,14 +6,13 @@ class YoutubeTranscriptTool(Tool):
|
|
| 8 |
inputs = {'video_id': {'type': 'string', 'description': 'The Id of YouTube video'}}
|
| 9 |
output_type = "list[dict]"
|
| 10 |
|
| 11 |
-
def __init__(self
|
| 12 |
super().__init__()
|
| 13 |
-
self.max_results = max_results
|
| 14 |
try:
|
| 15 |
from youtube_transcript_api import YouTubeTranscriptApi
|
| 16 |
except ImportError as e:
|
| 17 |
raise ImportError(
|
| 18 |
-
"You must install package `
|
| 19 |
) from e
|
| 20 |
self.ytt_api = YouTubeTranscriptApi()
|
| 21 |
|
|
|
|
|
|
|
| 1 |
from smolagents.tools import Tool
|
|
|
|
| 2 |
|
| 3 |
class YoutubeTranscriptTool(Tool):
|
| 4 |
name = "youtube_transcript"
|
|
|
|
| 6 |
inputs = {'video_id': {'type': 'string', 'description': 'The Id of YouTube video'}}
|
| 7 |
output_type = "list[dict]"
|
| 8 |
|
| 9 |
+
def __init__(self):
|
| 10 |
super().__init__()
|
|
|
|
| 11 |
try:
|
| 12 |
from youtube_transcript_api import YouTubeTranscriptApi
|
| 13 |
except ImportError as e:
|
| 14 |
raise ImportError(
|
| 15 |
+
"You must install package `youtube_transcript_api` to run this tool: for instance run `pip install youtube_transcript_api`."
|
| 16 |
) from e
|
| 17 |
self.ytt_api = YouTubeTranscriptApi()
|
| 18 |
|