media-downloader 0.11.5__py2.py3-none-any.whl → 0.11.7__py2.py3-none-any.whl
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.
Potentially problematic release.
This version of media-downloader might be problematic. Click here for more details.
- media_downloader/__main__.py +6 -0
- media_downloader/media_downloader_mcp.py +107 -0
- media_downloader/version.py +1 -1
- {media_downloader-0.11.5.dist-info → media_downloader-0.11.7.dist-info}/METADATA +26 -6
- media_downloader-0.11.7.dist-info/RECORD +11 -0
- {media_downloader-0.11.5.dist-info → media_downloader-0.11.7.dist-info}/WHEEL +1 -1
- {media_downloader-0.11.5.dist-info → media_downloader-0.11.7.dist-info}/entry_points.txt +1 -1
- media_downloader-0.11.5.dist-info/RECORD +0 -9
- {media_downloader-0.11.5.dist-info → media_downloader-0.11.7.dist-info}/LICENSE +0 -0
- {media_downloader-0.11.5.dist-info → media_downloader-0.11.7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
import getopt
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
from media_downloader import MediaDownloader
|
|
7
|
+
from fastmcp import FastMCP
|
|
8
|
+
|
|
9
|
+
mcp = FastMCP("MediaDownloaderServer")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@mcp.tool()
|
|
13
|
+
async def download_media(
|
|
14
|
+
video_url: str, download_directory: str, audio_only: bool = False
|
|
15
|
+
) -> str:
|
|
16
|
+
"""Downloads media from a given URL to the specified directory.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
video_url (str): The URL of the media to download.
|
|
20
|
+
download_directory (str): The directory where the media will be saved.
|
|
21
|
+
audio_only (bool): If True, downloads only the audio. Defaults to False.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
str: The path to the downloaded media file.
|
|
25
|
+
|
|
26
|
+
Raises:
|
|
27
|
+
ValueError: If the URL or directory is invalid.
|
|
28
|
+
RuntimeError: If the download fails.
|
|
29
|
+
"""
|
|
30
|
+
try:
|
|
31
|
+
# Validate inputs
|
|
32
|
+
if not video_url or not download_directory:
|
|
33
|
+
raise ValueError("video_url and download_directory must not be empty")
|
|
34
|
+
|
|
35
|
+
# Ensure the download directory exists
|
|
36
|
+
os.makedirs(download_directory, exist_ok=True)
|
|
37
|
+
|
|
38
|
+
# Initialize MediaDownloader
|
|
39
|
+
downloader = MediaDownloader()
|
|
40
|
+
downloader.set_audio(audio=audio_only)
|
|
41
|
+
downloader.set_save_path(download_directory)
|
|
42
|
+
downloader.append_link(video_url)
|
|
43
|
+
|
|
44
|
+
# Perform the download
|
|
45
|
+
downloader.download_all()
|
|
46
|
+
|
|
47
|
+
# Assume download_all() saves the file and the path can be retrieved
|
|
48
|
+
# Adjust this based on actual MediaDownloader behavior
|
|
49
|
+
save_path = os.path.join(download_directory, video_url.split("/")[-1])
|
|
50
|
+
if not os.path.exists(save_path):
|
|
51
|
+
raise RuntimeError("Download failed or file not found")
|
|
52
|
+
|
|
53
|
+
return download_directory
|
|
54
|
+
except Exception as e:
|
|
55
|
+
raise RuntimeError(f"Failed to download media: {str(e)}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def media_downloader_mcp(argv):
|
|
59
|
+
transport = "stdio"
|
|
60
|
+
host = "0.0.0.0"
|
|
61
|
+
port = 5000
|
|
62
|
+
try:
|
|
63
|
+
opts, args = getopt.getopt(
|
|
64
|
+
argv,
|
|
65
|
+
"ht:h:p:",
|
|
66
|
+
["help", "transport=", "host=", "port="],
|
|
67
|
+
)
|
|
68
|
+
except getopt.GetoptError:
|
|
69
|
+
sys.exit(2)
|
|
70
|
+
for opt, arg in opts:
|
|
71
|
+
if opt in ("-h", "--help"):
|
|
72
|
+
sys.exit()
|
|
73
|
+
elif opt in ("-t", "--transport"):
|
|
74
|
+
transport = arg
|
|
75
|
+
elif opt in ("-h", "--host"):
|
|
76
|
+
host = arg
|
|
77
|
+
elif opt in ("-p", "--port"):
|
|
78
|
+
port = arg
|
|
79
|
+
if transport == "stdio":
|
|
80
|
+
mcp.run(transport="stdio")
|
|
81
|
+
else:
|
|
82
|
+
mcp.run(transport="tcp", host=host, port=port)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def client():
|
|
86
|
+
# Connect to the server (update host/port if using TCP)
|
|
87
|
+
client = MCPClient(host="localhost", port=5000)
|
|
88
|
+
|
|
89
|
+
# Call the download_media tool
|
|
90
|
+
response = client.call_tool(
|
|
91
|
+
"download_media",
|
|
92
|
+
{
|
|
93
|
+
"video_url": "https://example.com/video.mp4",
|
|
94
|
+
"download_directory": "./downloads",
|
|
95
|
+
"audio_only": False,
|
|
96
|
+
},
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
print(f"Downloaded file path: {response}")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def main():
|
|
103
|
+
media_downloader_mcp(sys.argv[1:])
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
media_downloader_mcp(sys.argv[1:])
|
media_downloader/version.py
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: media-downloader
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.7
|
|
4
4
|
Summary: Download audio/videos from the internet!
|
|
5
5
|
Home-page: https://github.com/Knuckles-Team/media-downloader
|
|
6
6
|
Author: Audel Rouhi
|
|
7
7
|
Author-email: knucklessg1@gmail.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
10
|
Classifier: License :: Public Domain
|
|
12
11
|
Classifier: Environment :: Console
|
|
13
12
|
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.8
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
21
|
Description-Content-Type: text/markdown
|
|
20
22
|
License-File: LICENSE
|
|
23
|
+
Requires-Dist: fastmcp (>=2.11.3)
|
|
21
24
|
Requires-Dist: yt-dlp (>=2023.12.30)
|
|
22
25
|
|
|
23
26
|
# Media Downloader
|
|
@@ -42,11 +45,11 @@ Requires-Dist: yt-dlp (>=2023.12.30)
|
|
|
42
45
|

|
|
43
46
|

|
|
44
47
|
|
|
45
|
-
*Version: 0.11.
|
|
48
|
+
*Version: 0.11.7*
|
|
46
49
|
|
|
47
50
|
Download videos and audio from the internet!
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
MCP Server Support!
|
|
50
53
|
|
|
51
54
|
This repository is actively maintained - Contributions are welcome!
|
|
52
55
|
|
|
@@ -111,6 +114,25 @@ video_downloader_instance.open_file("FILE")
|
|
|
111
114
|
# Optional - Enter a YouTube channel name and download their latest videos
|
|
112
115
|
video_downloader_instance.get_channel_videos("YT-Channel Name")
|
|
113
116
|
```
|
|
117
|
+
|
|
118
|
+
Use with AI
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
python -m media_downloader_mcp
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"media_downloader": {
|
|
128
|
+
"command": "python",
|
|
129
|
+
"args": ["-m", "media_downloader_mcp"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
|
|
114
136
|
</details>
|
|
115
137
|
|
|
116
138
|
<details>
|
|
@@ -149,5 +171,3 @@ python -m pip install geniusbot
|
|
|
149
171
|

|
|
150
172
|

|
|
151
173
|
</details>
|
|
152
|
-
|
|
153
|
-
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
media_downloader/__init__.py,sha256=NdFVoFJM5ltTmSM7Be2Hfx7u8CHFwdYYw2zciU1Z-Qw,407
|
|
2
|
+
media_downloader/__main__.py,sha256=aHajZBE7fyiC7E5qjV5LMe9nCPkQV2YKu6FU8Ubkdm4,112
|
|
3
|
+
media_downloader/media_downloader.py,sha256=qluLse0xZemaSOTRUqJYXt93M0rqjsiaKM5QGrfZZuk,9570
|
|
4
|
+
media_downloader/media_downloader_mcp.py,sha256=kKs0CIersTwv4BlpsMDXlCRC4qnnsfEayYdquHqFkzc,3066
|
|
5
|
+
media_downloader/version.py,sha256=RsxqTnivVUssGYDT5wFkXGO8DC2LPX07gswLrWdPbww,117
|
|
6
|
+
media_downloader-0.11.7.dist-info/LICENSE,sha256=Z1xmcrPHBnGCETO_LLQJUeaSNBSnuptcDVTt4kaPUOE,1060
|
|
7
|
+
media_downloader-0.11.7.dist-info/METADATA,sha256=IgZfIa3sqxi1Aq3sPn1uvovNFYKB8Ra0lBatR0M0-to,5521
|
|
8
|
+
media_downloader-0.11.7.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
|
|
9
|
+
media_downloader-0.11.7.dist-info/entry_points.txt,sha256=Hjp1vLkHPq_bABsuh4kpL5nddi1wn9Ftota-72_GgW4,142
|
|
10
|
+
media_downloader-0.11.7.dist-info/top_level.txt,sha256=B2OBmgONOm0hIyx2HJ8qFPOI_p5HOeolrYvmslVC1fc,17
|
|
11
|
+
media_downloader-0.11.7.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
media_downloader/__init__.py,sha256=NdFVoFJM5ltTmSM7Be2Hfx7u8CHFwdYYw2zciU1Z-Qw,407
|
|
2
|
-
media_downloader/media_downloader.py,sha256=qluLse0xZemaSOTRUqJYXt93M0rqjsiaKM5QGrfZZuk,9570
|
|
3
|
-
media_downloader/version.py,sha256=1ess5zv1cnovCGPWYpp1aH04etqebw86R0ZM9Qt25mo,117
|
|
4
|
-
media_downloader-0.11.5.dist-info/LICENSE,sha256=Z1xmcrPHBnGCETO_LLQJUeaSNBSnuptcDVTt4kaPUOE,1060
|
|
5
|
-
media_downloader-0.11.5.dist-info/METADATA,sha256=ywTWRhvuUOBR7co0UNBrgVUxBttT9mXpezCyU-CdJtg,5228
|
|
6
|
-
media_downloader-0.11.5.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
|
|
7
|
-
media_downloader-0.11.5.dist-info/entry_points.txt,sha256=ZYFDwE25i9D2Mc_ZkLbA0ASaUJo_IEOGDU2gXO7OQnE,77
|
|
8
|
-
media_downloader-0.11.5.dist-info/top_level.txt,sha256=B2OBmgONOm0hIyx2HJ8qFPOI_p5HOeolrYvmslVC1fc,17
|
|
9
|
-
media_downloader-0.11.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|