yt-dlp-host-api 0.1.2__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 +10 -8
- {yt_dlp_host_api-0.1.2.dist-info → yt_dlp_host_api-0.1.3.dist-info}/METADATA +24 -13
- {yt_dlp_host_api-0.1.2.dist-info → yt_dlp_host_api-0.1.3.dist-info}/RECORD +6 -6
- {yt_dlp_host_api-0.1.2.dist-info → yt_dlp_host_api-0.1.3.dist-info}/LICENSE +0 -0
- {yt_dlp_host_api-0.1.2.dist-info → yt_dlp_host_api-0.1.3.dist-info}/WHEEL +0 -0
- {yt_dlp_host_api-0.1.2.dist-info → yt_dlp_host_api-0.1.3.dist-info}/top_level.txt +0 -0
yt_dlp_host_api/client.py
CHANGED
@@ -9,21 +9,23 @@ 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):
|
12
|
+
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", 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
17
|
start_time=start_time,
|
18
|
-
end_time=end_time
|
18
|
+
end_time=end_time,
|
19
|
+
force_keyframes=force_keyframes
|
19
20
|
).get_result()
|
20
21
|
|
21
|
-
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None):
|
22
|
+
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None, force_keyframes=False):
|
22
23
|
return self.send_task.get_audio(
|
23
24
|
url=url,
|
24
25
|
audio_format=audio_format,
|
25
26
|
start_time=start_time,
|
26
|
-
end_time=end_time
|
27
|
+
end_time=end_time,
|
28
|
+
force_keyframes=force_keyframes
|
27
29
|
).get_result()
|
28
30
|
|
29
31
|
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio"):
|
@@ -84,8 +86,8 @@ class Client:
|
|
84
86
|
def __init__(self, client):
|
85
87
|
self.client = client
|
86
88
|
|
87
|
-
def get_video(self, url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None):
|
88
|
-
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}
|
89
91
|
if start_time is not None: data["start_time"] = start_time
|
90
92
|
if end_time is not None: data["end_time"] = end_time
|
91
93
|
|
@@ -94,8 +96,8 @@ class Client:
|
|
94
96
|
raise APIError(response.json().get('error', 'Unknown error'))
|
95
97
|
return Task(self.client, response.json()['task_id'], 'get_video')
|
96
98
|
|
97
|
-
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None):
|
98
|
-
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}
|
99
101
|
if start_time is not None: data["start_time"] = start_time
|
100
102
|
if end_time is not None: data["end_time"] = end_time
|
101
103
|
|
@@ -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
|
@@ -40,20 +40,23 @@ client = api.get_client('YOUR_API_KEY')
|
|
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 video segment
|
43
|
+
# Download a video segment with precise cutting
|
44
44
|
client.get_video(
|
45
45
|
url='https://youtu.be/1FPdtR_5KFo',
|
46
|
-
|
47
|
-
|
48
|
-
|
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")
|
49
51
|
|
50
|
-
# Download a video segment
|
52
|
+
# Download a video segment with faster cutting at keyframes
|
51
53
|
client.get_video(
|
52
54
|
url='https://youtu.be/1FPdtR_5KFo',
|
53
55
|
start_time="00:05:00",
|
54
|
-
end_time="00:10:00"
|
55
|
-
|
56
|
-
|
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")
|
57
60
|
|
58
61
|
# Download a complete audio
|
59
62
|
client.get_audio(url='https://youtu.be/1FPdtR_5KFo').save_file("test_audio.mp3")
|
@@ -75,6 +78,8 @@ client.delete_key("user_key")
|
|
75
78
|
- Download YouTube videos
|
76
79
|
- Download complete videos
|
77
80
|
- Download specific time segments
|
81
|
+
- Precise cutting with frame re-encoding
|
82
|
+
- Fast cutting at keyframes
|
78
83
|
- Choose video and audio quality
|
79
84
|
- Download YouTube audio
|
80
85
|
- Download complete audio
|
@@ -93,13 +98,13 @@ client.delete_key("user_key")
|
|
93
98
|
|
94
99
|
### Client
|
95
100
|
|
96
|
-
- `client.get_video(url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None)`: Get video with optional time segment selection
|
97
|
-
- `client.get_audio(url, audio_format="bestaudio", start_time=None, end_time=None)`: Get audio with optional time segment selection
|
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
|
98
103
|
- `client.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`: Get live video segment
|
99
104
|
- `client.get_live_audio(url, duration, start=0, audio_format="bestaudio")`: Get live audio segment
|
100
105
|
- `client.get_info(url)`: Get video information
|
101
|
-
- `client.send_task.get_video(url, video_format="bestvideo", audio_format="bestaudio", start_time=None, end_time=None)`: Initiate a video download task
|
102
|
-
- `client.send_task.get_audio(url, audio_format="bestaudio", start_time=None, end_time=None)`: Initiate an audio download task
|
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
|
103
108
|
- `client.send_task.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`: Initiate a live video download task
|
104
109
|
- `client.send_task.get_live_audio(url, duration, start=0, audio_format="bestaudio")`: Initiate a live audio download task
|
105
110
|
- `client.send_task.get_info(url)`: Initiate an info retrieval task
|
@@ -113,6 +118,12 @@ Examples:
|
|
113
118
|
- "00:05:00" - 5 minutes
|
114
119
|
- "01:30:45" - 1 hour, 30 minutes, and 45 seconds
|
115
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.
|
126
|
+
|
116
127
|
### Task
|
117
128
|
|
118
129
|
- `task.get_status()`: Get the current status of a task
|
@@ -1,10 +1,10 @@
|
|
1
1
|
yt_dlp_host_api/__init__.py,sha256=RHx1BvH2Cy_dweEKo5sA-hdBOfBdY_2ds7srPuKGzWQ,41
|
2
2
|
yt_dlp_host_api/api.py,sha256=iLzWKoyiXeu0Y1Uky8PzpxxHTSMcTGzxlCRT121AKcM,196
|
3
|
-
yt_dlp_host_api/client.py,sha256=
|
3
|
+
yt_dlp_host_api/client.py,sha256=NY_j4TthSV0xrCuv2JuzrpNkuHIsTnoOQuegLbIJHBI,6482
|
4
4
|
yt_dlp_host_api/exceptions.py,sha256=U_70W1R_ZcUfKptUShGB5VPWQXwc5M29_sNC8pwwq8g,38
|
5
5
|
yt_dlp_host_api/task.py,sha256=llgBAO_L1CajklMsbICdRpLdOV05Wi0oUh9NKj0bD0w,2674
|
6
|
-
yt_dlp_host_api-0.1.
|
7
|
-
yt_dlp_host_api-0.1.
|
8
|
-
yt_dlp_host_api-0.1.
|
9
|
-
yt_dlp_host_api-0.1.
|
10
|
-
yt_dlp_host_api-0.1.
|
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
|
File without changes
|