mirror of
https://github.com/kevinwatt/yt-dlp-mcp.git
synced 2025-08-10 16:09:14 +03:00
feat(api): add start and end time docs and examples
This commit is contained in:
26
docs/api.md
26
docs/api.md
@@ -2,14 +2,16 @@
|
||||
|
||||
## Video Operations
|
||||
|
||||
### downloadVideo(url: string, config?: Config, resolution?: string): Promise<string>
|
||||
### downloadVideo(url: string, config?: Config, resolution?: string, startTime?: string, endTime?: string): Promise<string>
|
||||
|
||||
Downloads a video from the specified URL.
|
||||
Downloads a video from the specified URL with optional trimming.
|
||||
|
||||
**Parameters:**
|
||||
- `url`: The URL of the video to download
|
||||
- `config`: (Optional) Configuration object
|
||||
- `resolution`: (Optional) Preferred video resolution ('480p', '720p', '1080p', 'best')
|
||||
- `startTime`: (Optional) Start time for trimming (format: HH:MM:SS[.ms])
|
||||
- `endTime`: (Optional) End time for trimming (format: HH:MM:SS[.ms])
|
||||
|
||||
**Returns:**
|
||||
- Promise resolving to a success message with the downloaded file path
|
||||
@@ -29,6 +31,26 @@ const hdResult = await downloadVideo(
|
||||
'1080p'
|
||||
);
|
||||
console.log(hdResult);
|
||||
|
||||
// Download with trimming
|
||||
const trimmedResult = await downloadVideo(
|
||||
'https://www.youtube.com/watch?v=jNQXAC9IVRw',
|
||||
undefined,
|
||||
'720p',
|
||||
'00:01:30',
|
||||
'00:02:45'
|
||||
);
|
||||
console.log(trimmedResult);
|
||||
|
||||
// Download with fractional seconds
|
||||
const preciseTrim = await downloadVideo(
|
||||
'https://www.youtube.com/watch?v=jNQXAC9IVRw',
|
||||
undefined,
|
||||
'720p',
|
||||
'00:01:30.500',
|
||||
'00:02:45.250'
|
||||
);
|
||||
console.log(preciseTrim);
|
||||
```
|
||||
|
||||
## Audio Operations
|
||||
|
||||
Reference in New Issue
Block a user