media-downloader 0.11.5__py2.py3-none-any.whl → 0.11.6__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.

@@ -0,0 +1,6 @@
1
+ #!/usr/bin/python
2
+ # coding: utf-8
3
+ from .media_downloader_mcp import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,109 @@
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 mcp.server.fastmcp import FastMCP
8
+
9
+ from mcp.client import MCPClient
10
+
11
+ mcp = FastMCP("MediaDownloader")
12
+
13
+
14
+ @mcp.tool()
15
+ async def download_media(
16
+ video_url: str, download_directory: str, audio_only: bool = False
17
+ ) -> str:
18
+ """Downloads media from a given URL to the specified directory.
19
+
20
+ Args:
21
+ video_url (str): The URL of the media to download.
22
+ download_directory (str): The directory where the media will be saved.
23
+ audio_only (bool): If True, downloads only the audio. Defaults to False.
24
+
25
+ Returns:
26
+ str: The path to the downloaded media file.
27
+
28
+ Raises:
29
+ ValueError: If the URL or directory is invalid.
30
+ RuntimeError: If the download fails.
31
+ """
32
+ try:
33
+ # Validate inputs
34
+ if not video_url or not download_directory:
35
+ raise ValueError("video_url and download_directory must not be empty")
36
+
37
+ # Ensure the download directory exists
38
+ os.makedirs(download_directory, exist_ok=True)
39
+
40
+ # Initialize MediaDownloader
41
+ downloader = MediaDownloader()
42
+ downloader.set_audio(audio=audio_only)
43
+ downloader.set_save_path(download_directory)
44
+ downloader.append_link(video_url)
45
+
46
+ # Perform the download
47
+ downloader.download_all()
48
+
49
+ # Assume download_all() saves the file and the path can be retrieved
50
+ # Adjust this based on actual MediaDownloader behavior
51
+ save_path = os.path.join(download_directory, video_url.split("/")[-1])
52
+ if not os.path.exists(save_path):
53
+ raise RuntimeError("Download failed or file not found")
54
+
55
+ return download_directory
56
+ except Exception as e:
57
+ raise RuntimeError(f"Failed to download media: {str(e)}")
58
+
59
+
60
+ def media_downloader_mcp(argv):
61
+ transport = "stdio"
62
+ host = None
63
+ port = None
64
+ try:
65
+ opts, args = getopt.getopt(
66
+ argv,
67
+ "ht:h:p:",
68
+ ["help", "transport=", "host=", "port="],
69
+ )
70
+ except getopt.GetoptError:
71
+ sys.exit(2)
72
+ for opt, arg in opts:
73
+ if opt in ("-h", "--help"):
74
+ sys.exit()
75
+ elif opt in ("-t", "--transport"):
76
+ transport = arg
77
+ elif opt in ("-h", "--host"):
78
+ host = arg
79
+ elif opt in ("-p", "--port"):
80
+ port = arg
81
+ if transport == "stdio":
82
+ mcp.run(transport="stdio")
83
+ else:
84
+ mcp.run(transport="tcp", host=host, port=port)
85
+
86
+
87
+ def client():
88
+ # Connect to the server (update host/port if using TCP)
89
+ client = MCPClient(host="localhost", port=5000)
90
+
91
+ # Call the download_media tool
92
+ response = client.call_tool(
93
+ "download_media",
94
+ {
95
+ "video_url": "https://example.com/video.mp4",
96
+ "download_directory": "./downloads",
97
+ "audio_only": False,
98
+ },
99
+ )
100
+
101
+ print(f"Downloaded file path: {response}")
102
+
103
+
104
+ def main():
105
+ media_downloader_mcp(sys.argv[1:])
106
+
107
+
108
+ if __name__ == "__main__":
109
+ media_downloader_mcp(sys.argv[1:])
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
  # coding: utf-8
3
3
 
4
- __version__ = '0.11.5'
4
+ __version__ = "0.11.6"
5
5
  __author__ = "Audel Rouhi"
6
6
  __credits__ = "Audel Rouhi"
@@ -1,23 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: media-downloader
3
- Version: 0.11.5
3
+ Version: 0.11.6
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
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/media-downloader)
43
46
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/media-downloader)
44
47
 
45
- *Version: 0.11.5*
48
+ *Version: 0.11.6*
46
49
 
47
50
  Download videos and audio from the internet!
48
51
 
49
- This is a wrapper for the pytube library to simplify downloading from these various sources.
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
  ![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)
150
172
  ![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)
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=b97xktktEqgzoCjyBpV65t8tQUJOjwCDirYzp9H2Eq0,3100
5
+ media_downloader/version.py,sha256=hlQM5aK8UAB7AG9BFnU9k13-c6eI7aKIcTD_lTKsdhg,117
6
+ media_downloader-0.11.6.dist-info/LICENSE,sha256=Z1xmcrPHBnGCETO_LLQJUeaSNBSnuptcDVTt4kaPUOE,1060
7
+ media_downloader-0.11.6.dist-info/METADATA,sha256=mAdtO3NCudn2d0zDAqUdZSjZvKqBmybU3clGWYKmxy0,5521
8
+ media_downloader-0.11.6.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
9
+ media_downloader-0.11.6.dist-info/entry_points.txt,sha256=Hjp1vLkHPq_bABsuh4kpL5nddi1wn9Ftota-72_GgW4,142
10
+ media_downloader-0.11.6.dist-info/top_level.txt,sha256=B2OBmgONOm0hIyx2HJ8qFPOI_p5HOeolrYvmslVC1fc,17
11
+ media_downloader-0.11.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.1)
2
+ Generator: bdist_wheel (0.38.4)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -1,3 +1,3 @@
1
1
  [console_scripts]
2
2
  media-downloader = media_downloader.media_downloader:main
3
-
3
+ media-downloader-mcp = media_downloader.media_downloader_mcp:main
@@ -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,,