yt-dlp-host-api 0.1.3__py3-none-any.whl → 0.2.0__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.
- yt_dlp_host_api/client.py +43 -14
- {yt_dlp_host_api-0.1.3.dist-info → yt_dlp_host_api-0.2.0.dist-info}/METADATA +53 -18
- yt_dlp_host_api-0.2.0.dist-info/RECORD +10 -0
- {yt_dlp_host_api-0.1.3.dist-info → yt_dlp_host_api-0.2.0.dist-info}/WHEEL +1 -1
- yt_dlp_host_api-0.1.3.dist-info/RECORD +0 -10
- {yt_dlp_host_api-0.1.3.dist-info → yt_dlp_host_api-0.2.0.dist-info/licenses}/LICENSE +0 -0
- {yt_dlp_host_api-0.1.3.dist-info → yt_dlp_host_api-0.2.0.dist-info}/top_level.txt +0 -0
yt_dlp_host_api/client.py
CHANGED
@@ -9,40 +9,44 @@ class Client:
|
|
9
9
|
self.headers = {"X-API-Key": api_key, "Content-Type": "application/json"}
|
10
10
|
self.send_task = self.SendTask(self)
|
11
11
|
|
12
|
-
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
12
|
+
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", output_format="mp4", start_time=None, end_time=None, force_keyframes=False):
|
13
13
|
return self.send_task.get_video(
|
14
14
|
url=url,
|
15
15
|
video_format=video_format,
|
16
16
|
audio_format=audio_format,
|
17
|
+
output_format=output_format,
|
17
18
|
start_time=start_time,
|
18
19
|
end_time=end_time,
|
19
20
|
force_keyframes=force_keyframes
|
20
21
|
).get_result()
|
21
22
|
|
22
|
-
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
23
|
+
def get_audio(self, url, audio_format="bestaudio", output_format=None, start_time=None, end_time=None, force_keyframes=False):
|
23
24
|
return self.send_task.get_audio(
|
24
25
|
url=url,
|
25
26
|
audio_format=audio_format,
|
27
|
+
output_format=output_format,
|
26
28
|
start_time=start_time,
|
27
29
|
end_time=end_time,
|
28
30
|
force_keyframes=force_keyframes
|
29
31
|
).get_result()
|
30
32
|
|
31
|
-
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio"):
|
33
|
+
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio", output_format="mp4"):
|
32
34
|
return self.send_task.get_live_video(
|
33
35
|
url=url,
|
34
36
|
start=start,
|
35
37
|
duration=duration,
|
36
38
|
video_format=video_format,
|
37
|
-
audio_format=audio_format
|
39
|
+
audio_format=audio_format,
|
40
|
+
output_format=output_format
|
38
41
|
).get_result()
|
39
42
|
|
40
|
-
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio"):
|
43
|
+
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio", output_format=None):
|
41
44
|
return self.send_task.get_live_audio(
|
42
45
|
url=url,
|
43
46
|
start=start,
|
44
47
|
duration=duration,
|
45
|
-
audio_format=audio_format
|
48
|
+
audio_format=audio_format,
|
49
|
+
output_format=output_format
|
46
50
|
).get_result()
|
47
51
|
|
48
52
|
def get_info(self, url):
|
@@ -86,8 +90,14 @@ class Client:
|
|
86
90
|
def __init__(self, client):
|
87
91
|
self.client = client
|
88
92
|
|
89
|
-
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
90
|
-
data = {
|
93
|
+
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", output_format="mp4", start_time=None, end_time=None, force_keyframes=False):
|
94
|
+
data = {
|
95
|
+
"url": url,
|
96
|
+
"video_format": video_format,
|
97
|
+
"audio_format": audio_format,
|
98
|
+
"output_format": output_format,
|
99
|
+
"force_keyframes": force_keyframes
|
100
|
+
}
|
91
101
|
if start_time is not None: data["start_time"] = start_time
|
92
102
|
if end_time is not None: data["end_time"] = end_time
|
93
103
|
|
@@ -96,8 +106,13 @@ class Client:
|
|
96
106
|
raise APIError(response.json().get('error', 'Unknown error'))
|
97
107
|
return Task(self.client, response.json()['task_id'], 'get_video')
|
98
108
|
|
99
|
-
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
100
|
-
data = {
|
109
|
+
def get_audio(self, url, audio_format="bestaudio", output_format=None, start_time=None, end_time=None, force_keyframes=False):
|
110
|
+
data = {
|
111
|
+
"url": url,
|
112
|
+
"audio_format": audio_format,
|
113
|
+
"force_keyframes": force_keyframes
|
114
|
+
}
|
115
|
+
if output_format is not None: data["output_format"] = output_format
|
101
116
|
if start_time is not None: data["start_time"] = start_time
|
102
117
|
if end_time is not None: data["end_time"] = end_time
|
103
118
|
|
@@ -106,15 +121,29 @@ class Client:
|
|
106
121
|
raise APIError(response.json().get('error', 'Unknown error'))
|
107
122
|
return Task(self.client, response.json()['task_id'], 'get_audio')
|
108
123
|
|
109
|
-
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio"):
|
110
|
-
data = {
|
124
|
+
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio", output_format="mp4"):
|
125
|
+
data = {
|
126
|
+
"url": url,
|
127
|
+
"start": start,
|
128
|
+
"duration": duration,
|
129
|
+
"video_format": video_format,
|
130
|
+
"audio_format": audio_format,
|
131
|
+
"output_format": output_format
|
132
|
+
}
|
111
133
|
response = requests.post(f"{self.client.host_url}/get_live_video", json=data, headers=self.client.headers)
|
112
134
|
if response.status_code != 200:
|
113
135
|
raise APIError(response.json().get('error', 'Unknown error'))
|
114
136
|
return Task(self.client, response.json()['task_id'], 'get_video')
|
115
137
|
|
116
|
-
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio"):
|
117
|
-
data = {
|
138
|
+
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio", output_format=None):
|
139
|
+
data = {
|
140
|
+
"url": url,
|
141
|
+
"start": start,
|
142
|
+
"duration": duration,
|
143
|
+
"audio_format": audio_format
|
144
|
+
}
|
145
|
+
if output_format is not None: data["output_format"] = output_format
|
146
|
+
|
118
147
|
response = requests.post(f"{self.client.host_url}/get_live_audio", json=data, headers=self.client.headers)
|
119
148
|
if response.status_code != 200:
|
120
149
|
raise APIError(response.json().get('error', 'Unknown error'))
|
@@ -1,17 +1,18 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: yt_dlp_host_api
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: A Python library for interacting with the yt-dlp-host API
|
5
5
|
Author-email: "Amadeus (Wasys)" <tubik.corp@gmail.com>
|
6
|
+
License-Expression: MIT
|
6
7
|
Project-URL: Homepage, https://github.com/Vasysik/yt-dlp-host-api
|
7
8
|
Project-URL: Issues, https://github.com/Vasysik/yt-dlp-host-api/issues
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
10
|
Classifier: Operating System :: OS Independent
|
11
11
|
Requires-Python: >=3.8
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
License-File: LICENSE
|
14
|
-
Requires-Dist: requests
|
14
|
+
Requires-Dist: requests>=2.25.1
|
15
|
+
Dynamic: license-file
|
15
16
|
|
16
17
|
# [yt-dlp-host](https://github.com/Vasysik/yt-dlp-host) API Client
|
17
18
|
|
@@ -36,32 +37,42 @@ import yt_dlp_host_api
|
|
36
37
|
api = yt_dlp_host_api.api('http://your-api-url.com')
|
37
38
|
client = api.get_client('YOUR_API_KEY')
|
38
39
|
|
39
|
-
# Download a complete video
|
40
|
-
client.get_video(url='https://youtu.be/1FPdtR_5KFo').save_file("test_video.mp4")
|
40
|
+
# Download a complete video in MP4 format
|
41
|
+
client.get_video(url='https://youtu.be/1FPdtR_5KFo', output_format='mp4').save_file("test_video.mp4")
|
41
42
|
print("Video saved to test_video.mp4")
|
42
43
|
|
44
|
+
# Download a video in WebM format
|
45
|
+
client.get_video(url='https://youtu.be/1FPdtR_5KFo', output_format='webm').save_file("test_video.webm")
|
46
|
+
print("Video saved to test_video.webm")
|
47
|
+
|
43
48
|
# Download a video segment with precise cutting
|
44
49
|
client.get_video(
|
45
50
|
url='https://youtu.be/1FPdtR_5KFo',
|
51
|
+
output_format='mkv',
|
46
52
|
start_time="00:05:00",
|
47
53
|
end_time="00:10:00",
|
48
54
|
force_keyframes=True
|
49
|
-
).save_file("precise_cut.
|
50
|
-
print("Precisely cut segment saved to precise_cut.
|
55
|
+
).save_file("precise_cut.mkv")
|
56
|
+
print("Precisely cut segment saved to precise_cut.mkv")
|
51
57
|
|
52
58
|
# Download a video segment with faster cutting at keyframes
|
53
59
|
client.get_video(
|
54
60
|
url='https://youtu.be/1FPdtR_5KFo',
|
61
|
+
output_format='mp4',
|
55
62
|
start_time="00:05:00",
|
56
63
|
end_time="00:10:00",
|
57
64
|
force_keyframes=False
|
58
65
|
).save_file("keyframe_cut.mp4")
|
59
66
|
print("Keyframe-cut segment saved to keyframe_cut.mp4")
|
60
67
|
|
61
|
-
# Download a complete audio
|
62
|
-
client.get_audio(url='https://youtu.be/1FPdtR_5KFo').save_file("test_audio.mp3")
|
68
|
+
# Download a complete audio in MP3 format
|
69
|
+
client.get_audio(url='https://youtu.be/1FPdtR_5KFo', output_format='mp3').save_file("test_audio.mp3")
|
63
70
|
print("Audio saved to test_audio.mp3")
|
64
71
|
|
72
|
+
# Download audio in FLAC format (lossless)
|
73
|
+
client.get_audio(url='https://youtu.be/1FPdtR_5KFo', output_format='flac').save_file("test_audio.flac")
|
74
|
+
print("Audio saved to test_audio.flac")
|
75
|
+
|
65
76
|
# Get info
|
66
77
|
info_json = client.get_info(url='https://youtu.be/1FPdtR_5KFo').get_json(['qualities', 'title'])
|
67
78
|
print("Video info:", info_json)
|
@@ -81,10 +92,12 @@ client.delete_key("user_key")
|
|
81
92
|
- Precise cutting with frame re-encoding
|
82
93
|
- Fast cutting at keyframes
|
83
94
|
- Choose video and audio quality
|
95
|
+
- Choose output format (MP4, MKV, WebM, AVI, MOV, FLV, 3GP)
|
84
96
|
- Download YouTube audio
|
85
97
|
- Download complete audio
|
86
98
|
- Download specific time segments
|
87
99
|
- Choose audio quality
|
100
|
+
- Choose output format (MP3, M4A, Opus, FLAC, WAV, AAC, OGG)
|
88
101
|
- Extract live stream segments
|
89
102
|
- Retrieve video information
|
90
103
|
- Checking client permissions
|
@@ -98,18 +111,40 @@ client.delete_key("user_key")
|
|
98
111
|
|
99
112
|
### Client
|
100
113
|
|
101
|
-
- `client.get_video(url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False)`: Get video with optional time segment selection
|
102
|
-
- `client.get_audio(url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False)`: Get audio with optional time segment selection
|
103
|
-
- `client.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`: Get live video segment
|
104
|
-
- `client.get_live_audio(url, duration, start=0, audio_format="bestaudio")`: Get live audio segment
|
114
|
+
- `client.get_video(url, video_format="bestvideo", audio_format="bestaudio", output_format="mp4", start_time=None, end_time=None, force_keyframes=False)`: Get video with optional time segment selection
|
115
|
+
- `client.get_audio(url, audio_format="bestaudio", output_format=None, start_time=None, end_time=None, force_keyframes=False)`: Get audio with optional time segment selection
|
116
|
+
- `client.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio", output_format="mp4")`: Get live video segment
|
117
|
+
- `client.get_live_audio(url, duration, start=0, audio_format="bestaudio", output_format=None)`: Get live audio segment
|
105
118
|
- `client.get_info(url)`: Get video information
|
106
|
-
- `client.send_task.get_video(url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False)`: Initiate a video download task
|
107
|
-
- `client.send_task.get_audio(url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False)`: Initiate an audio download task
|
108
|
-
- `client.send_task.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`: Initiate a live video download task
|
109
|
-
- `client.send_task.get_live_audio(url, duration, start=0, audio_format="bestaudio")`: Initiate a live audio download task
|
119
|
+
- `client.send_task.get_video(url, video_format="bestvideo", audio_format="bestaudio", output_format="mp4", start_time=None, end_time=None, force_keyframes=False)`: Initiate a video download task
|
120
|
+
- `client.send_task.get_audio(url, audio_format="bestaudio", output_format=None, start_time=None, end_time=None, force_keyframes=False)`: Initiate an audio download task
|
121
|
+
- `client.send_task.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio", output_format="mp4")`: Initiate a live video download task
|
122
|
+
- `client.send_task.get_live_audio(url, duration, start=0, audio_format="bestaudio", output_format=None)`: Initiate a live audio download task
|
110
123
|
- `client.send_task.get_info(url)`: Initiate an info retrieval task
|
111
124
|
- `client.check_permissions(permissions)`: Check for all permissions in the list
|
112
125
|
|
126
|
+
### Supported Output Formats
|
127
|
+
|
128
|
+
#### Video Formats
|
129
|
+
- **mp4** - MPEG-4 Part 14 (recommended)
|
130
|
+
- **mkv** - Matroska
|
131
|
+
- **webm** - WebM
|
132
|
+
- **avi** - Audio Video Interleave
|
133
|
+
- **mov** - QuickTime File Format
|
134
|
+
- **flv** - Flash Video
|
135
|
+
- **3gp** - 3GPP multimedia
|
136
|
+
|
137
|
+
#### Audio Formats
|
138
|
+
- **mp3** - MPEG Audio Layer III
|
139
|
+
- **m4a** - MPEG-4 Audio
|
140
|
+
- **opus** - Opus Audio
|
141
|
+
- **flac** - Free Lossless Audio Codec
|
142
|
+
- **wav** - Waveform Audio File Format
|
143
|
+
- **aac** - Advanced Audio Coding
|
144
|
+
- **ogg** - Ogg Vorbis
|
145
|
+
|
146
|
+
Note: If `output_format` is not specified for audio, the original format will be used.
|
147
|
+
|
113
148
|
### Time Format
|
114
149
|
|
115
150
|
Time parameters (`start_time` and `end_time`) should be provided in the following format:
|
@@ -0,0 +1,10 @@
|
|
1
|
+
yt_dlp_host_api/__init__.py,sha256=RHx1BvH2Cy_dweEKo5sA-hdBOfBdY_2ds7srPuKGzWQ,41
|
2
|
+
yt_dlp_host_api/api.py,sha256=iLzWKoyiXeu0Y1Uky8PzpxxHTSMcTGzxlCRT121AKcM,196
|
3
|
+
yt_dlp_host_api/client.py,sha256=5Wf7Ue0A1HQX2EuaBk_TndOpWoDlb6t5NBslB0EljGI,7432
|
4
|
+
yt_dlp_host_api/exceptions.py,sha256=U_70W1R_ZcUfKptUShGB5VPWQXwc5M29_sNC8pwwq8g,38
|
5
|
+
yt_dlp_host_api/task.py,sha256=llgBAO_L1CajklMsbICdRpLdOV05Wi0oUh9NKj0bD0w,2674
|
6
|
+
yt_dlp_host_api-0.2.0.dist-info/licenses/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
|
7
|
+
yt_dlp_host_api-0.2.0.dist-info/METADATA,sha256=NBsJNdGgaSDD3z5Q-S7Sd1ZdjuXbQm8k_064IfMVBf0,7368
|
8
|
+
yt_dlp_host_api-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
yt_dlp_host_api-0.2.0.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
|
10
|
+
yt_dlp_host_api-0.2.0.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
yt_dlp_host_api/__init__.py,sha256=RHx1BvH2Cy_dweEKo5sA-hdBOfBdY_2ds7srPuKGzWQ,41
|
2
|
-
yt_dlp_host_api/api.py,sha256=iLzWKoyiXeu0Y1Uky8PzpxxHTSMcTGzxlCRT121AKcM,196
|
3
|
-
yt_dlp_host_api/client.py,sha256=NY_j4TthSV0xrCuv2JuzrpNkuHIsTnoOQuegLbIJHBI,6482
|
4
|
-
yt_dlp_host_api/exceptions.py,sha256=U_70W1R_ZcUfKptUShGB5VPWQXwc5M29_sNC8pwwq8g,38
|
5
|
-
yt_dlp_host_api/task.py,sha256=llgBAO_L1CajklMsbICdRpLdOV05Wi0oUh9NKj0bD0w,2674
|
6
|
-
yt_dlp_host_api-0.1.3.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
|
7
|
-
yt_dlp_host_api-0.1.3.dist-info/METADATA,sha256=geq0IJwW4ry9D-SIaD-wQsk8icTQqdmONgYEqGmc_Ws,5987
|
8
|
-
yt_dlp_host_api-0.1.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
9
|
-
yt_dlp_host_api-0.1.3.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
|
10
|
-
yt_dlp_host_api-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|