mcp-server-youtube-info 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/PKG-INFO +1 -1
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/pyproject.toml +1 -1
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/src/mcp_server_youtube_info/server.py +9 -8
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/.gitignore +0 -0
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/README.md +0 -0
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/src/mcp_server_youtube_info/__init__.py +0 -0
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/src/mcp_server_youtube_info/__main__.py +0 -0
- {mcp_server_youtube_info-0.1.2 → mcp_server_youtube_info-0.1.3}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-server-youtube-info
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: A YouTube information retrieval server implementation for Model Context Protocol (MCP)
|
5
5
|
Project-URL: Homepage, https://github.com/yareyaredesuyo/mcp-servers
|
6
6
|
Project-URL: Repository, https://github.com/yareyaredesuyo/mcp-servers.git
|
@@ -6,7 +6,7 @@ from PIL import Image as PILImage
|
|
6
6
|
|
7
7
|
mcp = FastMCP("MCP YouTube Info Server", dependencies=["httpx", "Pillow"])
|
8
8
|
|
9
|
-
def
|
9
|
+
def _extract_info(video_id: str) -> dict:
|
10
10
|
"""YouTubeの動画情報を取得します。
|
11
11
|
|
12
12
|
Args:
|
@@ -30,7 +30,7 @@ def extract_info(video_id: str) -> dict:
|
|
30
30
|
raise Exception(f"動画情報の取得に失敗しました: {str(e)}")
|
31
31
|
|
32
32
|
@mcp.tool()
|
33
|
-
def
|
33
|
+
def youtube_metainfo(video_id: str) -> dict:
|
34
34
|
"""YouTube動画のメタ情報を取得します。
|
35
35
|
|
36
36
|
Args:
|
@@ -40,12 +40,12 @@ def metainfo(video_id: str) -> dict:
|
|
40
40
|
dict: yt-dlpから取得した生のメタ情報
|
41
41
|
"""
|
42
42
|
try:
|
43
|
-
return
|
43
|
+
return _extract_info(video_id)
|
44
44
|
except Exception as e:
|
45
45
|
raise Exception(f"メタ情報の取得に失敗しました: {str(e)}")
|
46
46
|
|
47
47
|
@mcp.tool()
|
48
|
-
def
|
48
|
+
def youtube_thumbnail_url(video_id: str) -> str:
|
49
49
|
"""YouTubeのサムネイルURLを取得します。
|
50
50
|
|
51
51
|
Args:
|
@@ -55,7 +55,7 @@ def thumbnail(video_id: str) -> str:
|
|
55
55
|
str: サムネイル画像のURL
|
56
56
|
"""
|
57
57
|
try:
|
58
|
-
info =
|
58
|
+
info = _extract_info(video_id)
|
59
59
|
thumbnail_url = info.get('thumbnail')
|
60
60
|
if not thumbnail_url:
|
61
61
|
raise Exception("サムネイルURLが見つかりません")
|
@@ -63,7 +63,7 @@ def thumbnail(video_id: str) -> str:
|
|
63
63
|
except Exception as e:
|
64
64
|
raise Exception(f"サムネイルの取得に失敗しました: {str(e)}")
|
65
65
|
@mcp.tool()
|
66
|
-
def
|
66
|
+
def youtube_thumbnail_image(video_id: str) -> Image:
|
67
67
|
"""
|
68
68
|
指定されたYouTube動画のサムネイルをダウンロードし、Imageとして返す。
|
69
69
|
|
@@ -73,7 +73,7 @@ def download_thumbnail(video_id: str) -> Image:
|
|
73
73
|
Image: ダウンロードした画像データ
|
74
74
|
"""
|
75
75
|
try:
|
76
|
-
info =
|
76
|
+
info = _extract_info(video_id)
|
77
77
|
thumbnail_url = info.get('thumbnail')
|
78
78
|
if not thumbnail_url:
|
79
79
|
raise Exception("サムネイルURLが見つかりません")
|
@@ -88,7 +88,8 @@ def download_thumbnail(video_id: str) -> Image:
|
|
88
88
|
# 画像を読み込んで圧縮
|
89
89
|
image = PILImage.open(io.BytesIO(response.content)).convert('RGB')
|
90
90
|
buffer = io.BytesIO()
|
91
|
-
image.save(buffer, format="JPEG", quality=60, optimize=True)
|
91
|
+
# image.save(buffer, format="JPEG", quality=60, optimize=True)
|
92
|
+
image.save(buffer, format="JPEG", quality=60)
|
92
93
|
|
93
94
|
return Image(data=buffer.getvalue(), format="jpeg")
|
94
95
|
except httpx.HTTPStatusError as e:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|