yt-dlp-host-api 0.1.0__py3-none-any.whl → 0.1.2__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 +44 -16
- {yt_dlp_host_api-0.1.0.dist-info → yt_dlp_host_api-0.1.2.dist-info}/METADATA +45 -14
- yt_dlp_host_api-0.1.2.dist-info/RECORD +10 -0
- {yt_dlp_host_api-0.1.0.dist-info → yt_dlp_host_api-0.1.2.dist-info}/WHEEL +1 -1
- yt_dlp_host_api-0.1.0.dist-info/RECORD +0 -10
- {yt_dlp_host_api-0.1.0.dist-info → yt_dlp_host_api-0.1.2.dist-info}/LICENSE +0 -0
- {yt_dlp_host_api-0.1.0.dist-info → yt_dlp_host_api-0.1.2.dist-info}/top_level.txt +0 -0
yt_dlp_host_api/client.py
CHANGED
@@ -9,17 +9,39 @@ 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,
|
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):
|
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
|
+
).get_result()
|
14
20
|
|
15
|
-
def get_audio(self, url,
|
16
|
-
return self.send_task.get_audio(
|
21
|
+
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None):
|
22
|
+
return self.send_task.get_audio(
|
23
|
+
url=url,
|
24
|
+
audio_format=audio_format,
|
25
|
+
start_time=start_time,
|
26
|
+
end_time=end_time
|
27
|
+
).get_result()
|
17
28
|
|
18
|
-
def get_live_video(self, url, duration, start=0,
|
19
|
-
return self.send_task.get_live_video(
|
29
|
+
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio"):
|
30
|
+
return self.send_task.get_live_video(
|
31
|
+
url=url,
|
32
|
+
start=start,
|
33
|
+
duration=duration,
|
34
|
+
video_format=video_format,
|
35
|
+
audio_format=audio_format
|
36
|
+
).get_result()
|
20
37
|
|
21
|
-
def get_live_audio(self, url, duration, start=0,
|
22
|
-
return self.send_task.get_live_audio(
|
38
|
+
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio"):
|
39
|
+
return self.send_task.get_live_audio(
|
40
|
+
url=url,
|
41
|
+
start=start,
|
42
|
+
duration=duration,
|
43
|
+
audio_format=audio_format
|
44
|
+
).get_result()
|
23
45
|
|
24
46
|
def get_info(self, url):
|
25
47
|
return self.send_task.get_info(url=url).get_result()
|
@@ -62,29 +84,35 @@ class Client:
|
|
62
84
|
def __init__(self, client):
|
63
85
|
self.client = client
|
64
86
|
|
65
|
-
def get_video(self, url,
|
66
|
-
data = {"url": url, "
|
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
|
+
if start_time is not None: data["start_time"] = start_time
|
90
|
+
if end_time is not None: data["end_time"] = end_time
|
91
|
+
|
67
92
|
response = requests.post(f"{self.client.host_url}/get_video", json=data, headers=self.client.headers)
|
68
93
|
if response.status_code != 200:
|
69
94
|
raise APIError(response.json().get('error', 'Unknown error'))
|
70
95
|
return Task(self.client, response.json()['task_id'], 'get_video')
|
71
96
|
|
72
|
-
def get_audio(self, url,
|
73
|
-
data = {"url": url, "
|
97
|
+
def get_audio(self, url, audio_format="bestaudio", start_time=None, end_time=None):
|
98
|
+
data = {"url": url, "audio_format": audio_format}
|
99
|
+
if start_time is not None: data["start_time"] = start_time
|
100
|
+
if end_time is not None: data["end_time"] = end_time
|
101
|
+
|
74
102
|
response = requests.post(f"{self.client.host_url}/get_audio", json=data, headers=self.client.headers)
|
75
103
|
if response.status_code != 200:
|
76
104
|
raise APIError(response.json().get('error', 'Unknown error'))
|
77
105
|
return Task(self.client, response.json()['task_id'], 'get_audio')
|
78
106
|
|
79
|
-
def get_live_video(self, url, duration, start=0,
|
80
|
-
data = {"url": url, "start": start, "duration": duration, "
|
107
|
+
def get_live_video(self, url, duration, start=0, video_format="bestvideo", audio_format="bestaudio"):
|
108
|
+
data = {"url": url, "start": start, "duration": duration, "video_format": video_format, "audio_format": audio_format}
|
81
109
|
response = requests.post(f"{self.client.host_url}/get_live_video", json=data, headers=self.client.headers)
|
82
110
|
if response.status_code != 200:
|
83
111
|
raise APIError(response.json().get('error', 'Unknown error'))
|
84
112
|
return Task(self.client, response.json()['task_id'], 'get_video')
|
85
113
|
|
86
|
-
def get_live_audio(self, url, duration, start=0,
|
87
|
-
data = {"url": url, "start": start, "duration": duration, "
|
114
|
+
def get_live_audio(self, url, duration, start=0, audio_format="bestaudio"):
|
115
|
+
data = {"url": url, "start": start, "duration": duration, "audio_format": audio_format}
|
88
116
|
response = requests.post(f"{self.client.host_url}/get_live_audio", json=data, headers=self.client.headers)
|
89
117
|
if response.status_code != 200:
|
90
118
|
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.2
|
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,26 @@ 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 (first 5 minutes)
|
44
|
+
client.get_video(
|
45
|
+
url='https://youtu.be/1FPdtR_5KFo',
|
46
|
+
end_time="00:05:00"
|
47
|
+
).save_file("first_5min.mp4")
|
48
|
+
print("First 5 minutes saved to first_5min.mp4")
|
49
|
+
|
50
|
+
# Download a video segment (from 5 minutes to 10 minutes)
|
51
|
+
client.get_video(
|
52
|
+
url='https://youtu.be/1FPdtR_5KFo',
|
53
|
+
start_time="00:05:00",
|
54
|
+
end_time="00:10:00"
|
55
|
+
).save_file("5min_to_10min.mp4")
|
56
|
+
print("5-10 minute segment saved to 5min_to_10min.mp4")
|
57
|
+
|
58
|
+
# Download a complete audio
|
44
59
|
client.get_audio(url='https://youtu.be/1FPdtR_5KFo').save_file("test_audio.mp3")
|
45
60
|
print("Audio saved to test_audio.mp3")
|
46
61
|
|
@@ -58,6 +73,14 @@ client.delete_key("user_key")
|
|
58
73
|
## Features
|
59
74
|
|
60
75
|
- Download YouTube videos
|
76
|
+
- Download complete videos
|
77
|
+
- Download specific time segments
|
78
|
+
- Choose video and audio quality
|
79
|
+
- Download YouTube audio
|
80
|
+
- Download complete audio
|
81
|
+
- Download specific time segments
|
82
|
+
- Choose audio quality
|
83
|
+
- Extract live stream segments
|
61
84
|
- Retrieve video information
|
62
85
|
- Checking client permissions
|
63
86
|
- Admin operations:
|
@@ -70,17 +93,25 @@ client.delete_key("user_key")
|
|
70
93
|
|
71
94
|
### Client
|
72
95
|
|
73
|
-
- `client.get_video(url,
|
74
|
-
- `client.get_audio(url)`:
|
75
|
-
- `client.get_live_video(url, duration, start=0,
|
76
|
-
- `client.get_live_audio(url, duration, start=0)`:
|
77
|
-
- `client.get_info(url)`:
|
78
|
-
- `client.send_task.get_video(url,
|
79
|
-
- `client.send_task.get_audio(url)`:
|
80
|
-
- `client.send_task.get_live_video(url, duration, start=0,
|
81
|
-
- `client.send_task.get_live_audio(url, duration, start=0)`:
|
82
|
-
- `client.send_task.get_info(url)`:
|
83
|
-
- `client.check_permissions(permissions)`:
|
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
|
98
|
+
- `client.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`: Get live video segment
|
99
|
+
- `client.get_live_audio(url, duration, start=0, audio_format="bestaudio")`: Get live audio segment
|
100
|
+
- `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
|
103
|
+
- `client.send_task.get_live_video(url, duration, start=0, video_format="bestvideo", audio_format="bestaudio")`: Initiate a live video download task
|
104
|
+
- `client.send_task.get_live_audio(url, duration, start=0, audio_format="bestaudio")`: Initiate a live audio download task
|
105
|
+
- `client.send_task.get_info(url)`: Initiate an info retrieval task
|
106
|
+
- `client.check_permissions(permissions)`: Check for all permissions in the list
|
107
|
+
|
108
|
+
### Time Format
|
109
|
+
|
110
|
+
Time parameters (`start_time` and `end_time`) should be provided in the following format:
|
111
|
+
- "HH:MM:SS" (hours:minutes:seconds)
|
112
|
+
Examples:
|
113
|
+
- "00:05:00" - 5 minutes
|
114
|
+
- "01:30:45" - 1 hour, 30 minutes, and 45 seconds
|
84
115
|
|
85
116
|
### Task
|
86
117
|
|
@@ -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=6vGRfZ0WMLSzW_4pDGRL1_Nc8lDKZA2GkgFMxiXL_kI,6226
|
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.2.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
|
7
|
+
yt_dlp_host_api-0.1.2.dist-info/METADATA,sha256=E-J-hWokh7CGbGGCiphoh40ye_W-GgcVvViFi2VNurM,5311
|
8
|
+
yt_dlp_host_api-0.1.2.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
9
|
+
yt_dlp_host_api-0.1.2.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
|
10
|
+
yt_dlp_host_api-0.1.2.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=l8-pdx4NiKggWsGpMtR_-59Ix4Fprhtt9dq-VU4twN8,5390
|
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.0.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
|
7
|
-
yt_dlp_host_api-0.1.0.dist-info/METADATA,sha256=26qGluTLCP0ci6bAG9SlwrX3XA1fKxtIqwZcu0L7faQ,3972
|
8
|
-
yt_dlp_host_api-0.1.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
9
|
-
yt_dlp_host_api-0.1.0.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
|
10
|
-
yt_dlp_host_api-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|