Merge pull request #11 from hesreallyhim/fix/add-ignore-config

fix: add `--ignore-config` flag

Seems good, Thanks.
This commit is contained in:
Kevin Watt 2025-07-16 00:29:56 +08:00 committed by GitHub
commit bbc0e6aa93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 32 deletions

View File

@ -4,17 +4,20 @@
1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/your-username/yt-dlp-mcp.git
cd yt-dlp-mcp
```
3. Install dependencies:
```bash
npm install
```
4. Create a new branch:
```bash
git checkout -b feature/your-feature-name
```
@ -31,7 +34,7 @@ git checkout -b feature/your-feature-name
### Building
```bash
npm run build
npm run prepare
```
### Running Tests
@ -41,6 +44,7 @@ npm test
```
For specific test files:
```bash
npm test -- src/__tests__/video.test.ts
```
@ -72,10 +76,10 @@ interface DownloadOptions {
// Use enums for fixed values
enum Resolution {
SD = '480p',
HD = '720p',
FHD = '1080p',
BEST = 'best'
SD = "480p",
HD = "720p",
FHD = "1080p",
BEST = "best",
}
```
@ -91,16 +95,16 @@ enum Resolution {
Example:
```typescript
describe('downloadVideo', () => {
test('downloads video successfully', async () => {
describe("downloadVideo", () => {
test("downloads video successfully", async () => {
const result = await downloadVideo(testUrl);
expect(result).toMatch(/Video successfully downloaded/);
});
test('handles invalid URL', async () => {
await expect(downloadVideo('invalid-url'))
.rejects
.toThrow('Invalid or unsupported URL');
test("handles invalid URL", async () => {
await expect(downloadVideo("invalid-url")).rejects.toThrow(
"Invalid or unsupported URL"
);
});
});
```
@ -108,6 +112,7 @@ describe('downloadVideo', () => {
### Test Coverage
Aim for high test coverage:
```bash
npm run test:coverage
```
@ -118,7 +123,7 @@ npm run test:coverage
Add comprehensive JSDoc comments for all public APIs:
```typescript
````typescript
/**
* Downloads a video from the specified URL.
*
@ -141,7 +146,7 @@ export async function downloadVideo(
): Promise<string> {
// Implementation
}
```
````
### README Updates
@ -177,6 +182,7 @@ export async function downloadVideo(
### Version Numbers
Follow semantic versioning:
- MAJOR: Breaking changes
- MINOR: New features
- PATCH: Bug fixes

View File

@ -44,6 +44,8 @@ export async function downloadAudio(url: string, config: Config): Promise<string
: "bestaudio[ext=m4a]/bestaudio[ext=mp3]/bestaudio";
await _spawnPromise("yt-dlp", [
"--ignore-config",
"--no-check-certificate",
"--verbose",
"--progress",
"--newline",

View File

@ -28,6 +28,7 @@ export async function listSubtitles(url: string): Promise<string> {
try {
const output = await _spawnPromise('yt-dlp', [
'--ignore-config',
'--list-subs',
'--write-auto-sub',
'--skip-download',
@ -81,6 +82,7 @@ export async function downloadSubtitles(
try {
await _spawnPromise('yt-dlp', [
'--ignore-config',
'--write-sub',
'--write-auto-sub',
'--sub-lang', language,
@ -139,6 +141,7 @@ export async function downloadTranscript(
try {
await _spawnPromise('yt-dlp', [
'--ignore-config',
'--skip-download',
'--write-subs',
'--write-auto-subs',

View File

@ -89,6 +89,7 @@ export async function downloadVideo(
);
expectedFilename = await _spawnPromise("yt-dlp", [
"--ignore-config",
"--get-filename",
"-f", format,
"--output", outputTemplate,
@ -105,6 +106,7 @@ export async function downloadVideo(
// Download with progress info
try {
await _spawnPromise("yt-dlp", [
"--ignore-config",
"--progress",
"--newline",
"--no-mtime",