yt-dlp-host-api 0.1.1__py3-none-any.whl → 0.1.3__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 +40 -10
- {yt_dlp_host_api-0.1.1.dist-info → yt_dlp_host_api-0.1.3.dist-info}/METADATA +56 -14
- yt_dlp_host_api-0.1.3.dist-info/RECORD +10 -0
- {yt_dlp_host_api-0.1.1.dist-info → yt_dlp_host_api-0.1.3.dist-info}/WHEEL +1 -1
- yt_dlp_host_api-0.1.1.dist-info/RECORD +0 -10
- {yt_dlp_host_api-0.1.1.dist-info → yt_dlp_host_api-0.1.3.dist-info}/LICENSE +0 -0
- {yt_dlp_host_api-0.1.1.dist-info → yt_dlp_host_api-0.1.3.dist-info}/top_level.txt +0 -0
yt_dlp_host_api/client.py
CHANGED
@@ -9,17 +9,41 @@ 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"):
|
13
|
-
return self.send_task.get_video(
|
12
|
+
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
13
|
+
return self.send_task.get_video(
|
14
|
+
url=url,
|
15
|
+
video_format=video_format,
|
16
|
+
audio_format=audio_format,
|
17
|
+
start_time=start_time,
|
18
|
+
end_time=end_time,
|
19
|
+
force_keyframes=force_keyframes
|
20
|
+
).get_result()
|
14
21
|
|
15
|
-
def get_audio(self, url, audio_format="bestaudio"):
|
16
|
-
return self.send_task.get_audio(
|
22
|
+
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
23
|
+
return self.send_task.get_audio(
|
24
|
+
url=url,
|
25
|
+
audio_format=audio_format,
|
26
|
+
start_time=start_time,
|
27
|
+
end_time=end_time,
|
28
|
+
force_keyframes=force_keyframes
|
29
|
+
).get_result()
|
17
30
|
|
18
31
|
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio"):
|
19
|
-
return self.send_task.get_live_video(
|
32
|
+
return self.send_task.get_live_video(
|
33
|
+
url=url,
|
34
|
+
start=start,
|
35
|
+
duration=duration,
|
36
|
+
video_format=video_format,
|
37
|
+
audio_format=audio_format
|
38
|
+
).get_result()
|
20
39
|
|
21
40
|
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio"):
|
22
|
-
return self.send_task.get_live_audio(
|
41
|
+
return self.send_task.get_live_audio(
|
42
|
+
url=url,
|
43
|
+
start=start,
|
44
|
+
duration=duration,
|
45
|
+
audio_format=audio_format
|
46
|
+
).get_result()
|
23
47
|
|
24
48
|
def get_info(self, url):
|
25
49
|
return self.send_task.get_info(url=url).get_result()
|
@@ -62,15 +86,21 @@ class Client:
|
|
62
86
|
def __init__(self, client):
|
63
87
|
self.client = client
|
64
88
|
|
65
|
-
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio"):
|
66
|
-
data = {"url": url, "video_format": video_format, "audio_format": audio_format}
|
89
|
+
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
90
|
+
data = {"url": url, "video_format": video_format, "audio_format": audio_format, "force_keyframes": force_keyframes}
|
91
|
+
if start_time is not None: data["start_time"] = start_time
|
92
|
+
if end_time is not None: data["end_time"] = end_time
|
93
|
+
|
67
94
|
response = requests.post(f"{self.client.host_url}/get_video", json=data, headers=self.client.headers)
|
68
95
|
if response.status_code != 200:
|
69
96
|
raise APIError(response.json().get('error', 'Unknown error'))
|
70
97
|
return Task(self.client, response.json()['task_id'], 'get_video')
|
71
98
|
|
72
|
-
def get_audio(self, url, audio_format="bestaudio"):
|
73
|
-
data = {"url": url, "audio_format": audio_format}
|
99
|
+
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
100
|
+
data = {"url": url, "audio_format": audio_format, "force_keyframes": force_keyframes}
|
101
|
+
if start_time is not None: data["start_time"] = start_time
|
102
|
+
if end_time is not None: data["end_time"] = end_time
|
103
|
+
|
74
104
|
response = requests.post(f"{self.client.host_url}/get_audio", json=data, headers=self.client.headers)
|
75
105
|
if response.status_code != 200:
|
76
106
|
raise APIError(response.json().get('error', 'Unknown error'))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: yt_dlp_host_api
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
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
6
|
Project-URL: Homepage, https://github.com/Vasysik/yt-dlp-host-api
|
@@ -36,11 +36,29 @@ import yt_dlp_host_api
|
|
36
36
|
api = yt_dlp_host_api.api('http://your-api-url.com')
|
37
37
|
client = api.get_client('YOUR_API_KEY')
|
38
38
|
|
39
|
-
# Download a video
|
39
|
+
# Download a complete video
|
40
40
|
client.get_video(url='https://youtu.be/1FPdtR_5KFo').save_file("test_video.mp4")
|
41
41
|
print("Video saved to test_video.mp4")
|
42
42
|
|
43
|
-
# Download a
|
43
|
+
# Download a video segment with precise cutting
|
44
|
+
client.get_video(
|
45
|
+
url='https://youtu.be/1FPdtR_5KFo',
|
46
|
+
start_time="00:05:00",
|
47
|
+
end_time="00:10:00",
|
48
|
+
force_keyframes=True
|
49
|
+
).save_file("precise_cut.mp4")
|
50
|
+
print("Precisely cut segment saved to precise_cut.mp4")
|
51
|
+
|
52
|
+
# Download a video segment with faster cutting at keyframes
|
53
|
+
client.get_video(
|
54
|
+
url='https://youtu.be/1FPdtR_5KFo',
|
55
|
+
start_time="00:05:00",
|
56
|
+
end_time="00:10:00",
|
57
|
+
force_keyframes=False
|
58
|
+
).save_file("keyframe_cut.mp4")
|
59
|
+
print("Keyframe-cut segment saved to keyframe_cut.mp4")
|
60
|
+
|
61
|
+
# Download a complete audio
|
44
62
|
client.get_audio(url='https://youtu.be/1FPdtR_5KFo').save_file("test_audio.mp3")
|
45
63
|
print("Audio saved to test_audio.mp3")
|
46
64
|
|
@@ -58,6 +76,16 @@ client.delete_key("user_key")
|
|
58
76
|
## Features
|
59
77
|
|
60
78
|
- Download YouTube videos
|
79
|
+
- Download complete videos
|
80
|
+
- Download specific time segments
|
81
|
+
- Precise cutting with frame re-encoding
|
82
|
+
- Fast cutting at keyframes
|
83
|
+
- Choose video and audio quality
|
84
|
+
- Download YouTube audio
|
85
|
+
- Download complete audio
|
86
|
+
- Download specific time segments
|
87
|
+
- Choose audio quality
|
88
|
+
- Extract live stream segments
|
61
89
|
- Retrieve video information
|
62
90
|
- Checking client permissions
|
63
91
|
- Admin operations:
|
@@ -70,17 +98,31 @@ client.delete_key("user_key")
|
|
70
98
|
|
71
99
|
### Client
|
72
100
|
|
73
|
-
- `client.get_video(url, video_format="bestvideo", audio_format="bestaudio")`:
|
74
|
-
- `client.get_audio(url, audio_format="bestaudio")`:
|
75
|
-
- `client.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`:
|
76
|
-
- `client.get_live_audio(url, duration, start=0, audio_format="bestaudio")`:
|
77
|
-
- `client.get_info(url)`:
|
78
|
-
- `client.send_task.get_video(url, video_format="bestvideo", audio_format="bestaudio")`:
|
79
|
-
- `client.send_task.get_audio(url, audio_format="bestaudio")`:
|
80
|
-
- `client.send_task.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`:
|
81
|
-
- `client.send_task.get_live_audio(url, duration, start=0, audio_format="bestaudio")`:
|
82
|
-
- `client.send_task.get_info(url)`:
|
83
|
-
- `client.check_permissions(permissions)`:
|
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
|
105
|
+
- `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
|
110
|
+
- `client.send_task.get_info(url)`: Initiate an info retrieval task
|
111
|
+
- `client.check_permissions(permissions)`: Check for all permissions in the list
|
112
|
+
|
113
|
+
### Time Format
|
114
|
+
|
115
|
+
Time parameters (`start_time` and `end_time`) should be provided in the following format:
|
116
|
+
- "HH:MM:SS" (hours:minutes:seconds)
|
117
|
+
Examples:
|
118
|
+
- "00:05:00" - 5 minutes
|
119
|
+
- "01:30:45" - 1 hour, 30 minutes, and 45 seconds
|
120
|
+
|
121
|
+
### Cutting Modes
|
122
|
+
|
123
|
+
The `force_keyframes` parameter determines how video/audio segments are cut:
|
124
|
+
- `force_keyframes=False` (default): Faster cutting that aligns to nearest keyframes. May not be exactly at specified timestamps but is much faster as it avoids re-encoding.
|
125
|
+
- `force_keyframes=True`: Precise cutting at exact timestamps. This requires re-encoding which takes longer but provides exact cuts.
|
84
126
|
|
85
127
|
### Task
|
86
128
|
|
@@ -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=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,,
|
@@ -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=qFmyKQIOwmd_5C5V27iTrvYRsKWImksfeHSBJokMFdA,5414
|
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.1.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
|
7
|
-
yt_dlp_host_api-0.1.1.dist-info/METADATA,sha256=zkMxELh07KcHK3vpHeE19Ohy7gqdehSaDFwA2GX_rTc,4220
|
8
|
-
yt_dlp_host_api-0.1.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
9
|
-
yt_dlp_host_api-0.1.1.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
|
10
|
-
yt_dlp_host_api-0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|